mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
[wpilib] Rename PneumaticsModuleType constants
This commit is contained in:
@@ -197,7 +197,7 @@ public class Compressor implements Sendable, AutoCloseable {
|
||||
builder.addBooleanProperty("Enabled", this::isEnabled, null);
|
||||
builder.addBooleanProperty("Pressure switch", this::getPressureSwitchValue, null);
|
||||
builder.addDoubleProperty("Current (A)", this::getCurrent, null);
|
||||
if (m_moduleType == PneumaticsModuleType.REVPH) { // These are not supported by the CTRE PCM
|
||||
if (m_moduleType == PneumaticsModuleType.REV_PH) { // These are not supported by the CTRE PCM
|
||||
builder.addDoubleProperty("Analog Voltage", this::getAnalogVoltage, null);
|
||||
builder.addDoubleProperty("Pressure (PSI)", this::getPressure, null);
|
||||
}
|
||||
|
||||
@@ -201,18 +201,18 @@ public class PneumaticHub implements PneumaticsBase {
|
||||
|
||||
@Override
|
||||
public Solenoid makeSolenoid(int channel) {
|
||||
return new Solenoid(m_dataStore.m_module, PneumaticsModuleType.REVPH, channel);
|
||||
return new Solenoid(m_dataStore.m_module, PneumaticsModuleType.REV_PH, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSolenoid makeDoubleSolenoid(int forwardChannel, int reverseChannel) {
|
||||
return new DoubleSolenoid(
|
||||
m_dataStore.m_module, PneumaticsModuleType.REVPH, forwardChannel, reverseChannel);
|
||||
m_dataStore.m_module, PneumaticsModuleType.REV_PH, forwardChannel, reverseChannel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Compressor makeCompressor() {
|
||||
return new Compressor(m_dataStore.m_module, PneumaticsModuleType.REVPH);
|
||||
return new Compressor(m_dataStore.m_module, PneumaticsModuleType.REV_PH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,8 +18,8 @@ public interface PneumaticsBase extends AutoCloseable {
|
||||
*/
|
||||
static PneumaticsBase getForType(int busId, int module, PneumaticsModuleType type) {
|
||||
return switch (type) {
|
||||
case CTREPCM -> new PneumaticsControlModule(busId, module);
|
||||
case REVPH -> new PneumaticHub(busId, module);
|
||||
case CTRE_PCM -> new PneumaticsControlModule(busId, module);
|
||||
case REV_PH -> new PneumaticHub(busId, module);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ public interface PneumaticsBase extends AutoCloseable {
|
||||
*/
|
||||
static int getDefaultForType(PneumaticsModuleType type) {
|
||||
return switch (type) {
|
||||
case CTREPCM -> SensorUtil.getDefaultCTREPCMModule();
|
||||
case REVPH -> SensorUtil.getDefaultREVPHModule();
|
||||
case CTRE_PCM -> SensorUtil.getDefaultCTREPCMModule();
|
||||
case REV_PH -> SensorUtil.getDefaultREVPHModule();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -265,18 +265,18 @@ public class PneumaticsControlModule implements PneumaticsBase {
|
||||
|
||||
@Override
|
||||
public Solenoid makeSolenoid(int channel) {
|
||||
return new Solenoid(m_dataStore.m_module, PneumaticsModuleType.CTREPCM, channel);
|
||||
return new Solenoid(m_dataStore.m_module, PneumaticsModuleType.CTRE_PCM, channel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DoubleSolenoid makeDoubleSolenoid(int forwardChannel, int reverseChannel) {
|
||||
return new DoubleSolenoid(
|
||||
m_dataStore.m_module, PneumaticsModuleType.CTREPCM, forwardChannel, reverseChannel);
|
||||
m_dataStore.m_module, PneumaticsModuleType.CTRE_PCM, forwardChannel, reverseChannel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Compressor makeCompressor() {
|
||||
return new Compressor(m_dataStore.m_module, PneumaticsModuleType.CTREPCM);
|
||||
return new Compressor(m_dataStore.m_module, PneumaticsModuleType.CTRE_PCM);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ package org.wpilib.hardware.pneumatic;
|
||||
/** Pneumatics module type. */
|
||||
public enum PneumaticsModuleType {
|
||||
/** CTRE PCM. */
|
||||
CTREPCM,
|
||||
CTRE_PCM,
|
||||
/** REV PH. */
|
||||
REVPH
|
||||
REV_PH
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ public abstract class PneumaticsBaseSim {
|
||||
*/
|
||||
public static PneumaticsBaseSim getForType(int module, PneumaticsModuleType type) {
|
||||
return switch (type) {
|
||||
case CTREPCM -> new CTREPCMSim(module);
|
||||
case REVPH -> new REVPHSim(module);
|
||||
case CTRE_PCM -> new CTREPCMSim(module);
|
||||
case REV_PH -> new REVPHSim(module);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.wpilib.hardware.hal.util.AllocationException;
|
||||
class DoubleSolenoidTestCTRE {
|
||||
@Test
|
||||
void testValidInitialization() {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.CTREPCM, 2, 3)) {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2, 3)) {
|
||||
solenoid.set(DoubleSolenoid.Value.REVERSE);
|
||||
assertEquals(DoubleSolenoid.Value.REVERSE, solenoid.get());
|
||||
|
||||
@@ -29,10 +29,10 @@ class DoubleSolenoidTestCTRE {
|
||||
void testThrowForwardPortAlreadyInitialized() {
|
||||
try (
|
||||
// Single solenoid that is reused for forward port
|
||||
Solenoid solenoid = new Solenoid(0, 5, PneumaticsModuleType.CTREPCM, 2)) {
|
||||
Solenoid solenoid = new Solenoid(0, 5, PneumaticsModuleType.CTRE_PCM, 2)) {
|
||||
assertThrows(
|
||||
AllocationException.class,
|
||||
() -> new DoubleSolenoid(0, 5, PneumaticsModuleType.CTREPCM, 2, 3));
|
||||
() -> new DoubleSolenoid(0, 5, PneumaticsModuleType.CTRE_PCM, 2, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ class DoubleSolenoidTestCTRE {
|
||||
void testThrowReversePortAlreadyInitialized() {
|
||||
try (
|
||||
// Single solenoid that is reused for forward port
|
||||
Solenoid solenoid = new Solenoid(0, 6, PneumaticsModuleType.CTREPCM, 3)) {
|
||||
Solenoid solenoid = new Solenoid(0, 6, PneumaticsModuleType.CTRE_PCM, 3)) {
|
||||
assertThrows(
|
||||
AllocationException.class,
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.CTREPCM, 2, 3));
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.CTRE_PCM, 2, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,17 +51,17 @@ class DoubleSolenoidTestCTRE {
|
||||
void testThrowBothPortsAlreadyInitialized() {
|
||||
try (
|
||||
// Single solenoid that is reused for forward port
|
||||
Solenoid solenoid0 = new Solenoid(0, 6, PneumaticsModuleType.CTREPCM, 2);
|
||||
Solenoid solenoid1 = new Solenoid(0, 6, PneumaticsModuleType.CTREPCM, 3)) {
|
||||
Solenoid solenoid0 = new Solenoid(0, 6, PneumaticsModuleType.CTRE_PCM, 2);
|
||||
Solenoid solenoid1 = new Solenoid(0, 6, PneumaticsModuleType.CTRE_PCM, 3)) {
|
||||
assertThrows(
|
||||
AllocationException.class,
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.CTREPCM, 2, 3));
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.CTRE_PCM, 2, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToggle() {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 4, PneumaticsModuleType.CTREPCM, 2, 3)) {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 4, PneumaticsModuleType.CTRE_PCM, 2, 3)) {
|
||||
// Bootstrap it into reverse
|
||||
solenoid.set(DoubleSolenoid.Value.REVERSE);
|
||||
|
||||
@@ -82,13 +82,13 @@ class DoubleSolenoidTestCTRE {
|
||||
void testInvalidForwardPort() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new DoubleSolenoid(0, 0, PneumaticsModuleType.CTREPCM, 100, 1));
|
||||
() -> new DoubleSolenoid(0, 0, PneumaticsModuleType.CTRE_PCM, 100, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInvalidReversePort() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new DoubleSolenoid(0, 0, PneumaticsModuleType.CTREPCM, 0, 100));
|
||||
() -> new DoubleSolenoid(0, 0, PneumaticsModuleType.CTRE_PCM, 0, 100));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.wpilib.hardware.hal.util.AllocationException;
|
||||
class DoubleSolenoidTestREV {
|
||||
@Test
|
||||
void testValidInitialization() {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.REVPH, 2, 3)) {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.REV_PH, 2, 3)) {
|
||||
solenoid.set(DoubleSolenoid.Value.REVERSE);
|
||||
assertEquals(DoubleSolenoid.Value.REVERSE, solenoid.get());
|
||||
|
||||
@@ -29,10 +29,10 @@ class DoubleSolenoidTestREV {
|
||||
void testThrowForwardPortAlreadyInitialized() {
|
||||
try (
|
||||
// Single solenoid that is reused for forward port
|
||||
Solenoid solenoid = new Solenoid(0, 5, PneumaticsModuleType.REVPH, 2)) {
|
||||
Solenoid solenoid = new Solenoid(0, 5, PneumaticsModuleType.REV_PH, 2)) {
|
||||
assertThrows(
|
||||
AllocationException.class,
|
||||
() -> new DoubleSolenoid(0, 5, PneumaticsModuleType.REVPH, 2, 3));
|
||||
() -> new DoubleSolenoid(0, 5, PneumaticsModuleType.REV_PH, 2, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,10 +40,10 @@ class DoubleSolenoidTestREV {
|
||||
void testThrowReversePortAlreadyInitialized() {
|
||||
try (
|
||||
// Single solenoid that is reused for forward port
|
||||
Solenoid solenoid = new Solenoid(0, 6, PneumaticsModuleType.REVPH, 3)) {
|
||||
Solenoid solenoid = new Solenoid(0, 6, PneumaticsModuleType.REV_PH, 3)) {
|
||||
assertThrows(
|
||||
AllocationException.class,
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.REVPH, 2, 3));
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.REV_PH, 2, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,17 +51,17 @@ class DoubleSolenoidTestREV {
|
||||
void testThrowBothPortsAlreadyInitialized() {
|
||||
try (
|
||||
// Single solenoid that is reused for forward port
|
||||
Solenoid solenoid0 = new Solenoid(0, 6, PneumaticsModuleType.REVPH, 2);
|
||||
Solenoid solenoid1 = new Solenoid(0, 6, PneumaticsModuleType.REVPH, 3)) {
|
||||
Solenoid solenoid0 = new Solenoid(0, 6, PneumaticsModuleType.REV_PH, 2);
|
||||
Solenoid solenoid1 = new Solenoid(0, 6, PneumaticsModuleType.REV_PH, 3)) {
|
||||
assertThrows(
|
||||
AllocationException.class,
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.REVPH, 2, 3));
|
||||
() -> new DoubleSolenoid(0, 6, PneumaticsModuleType.REV_PH, 2, 3));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToggle() {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 4, PneumaticsModuleType.REVPH, 2, 3)) {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 4, PneumaticsModuleType.REV_PH, 2, 3)) {
|
||||
// Bootstrap it into reverse
|
||||
solenoid.set(DoubleSolenoid.Value.REVERSE);
|
||||
|
||||
@@ -82,13 +82,13 @@ class DoubleSolenoidTestREV {
|
||||
void testInvalidForwardPort() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new DoubleSolenoid(0, 1, PneumaticsModuleType.REVPH, 100, 1));
|
||||
() -> new DoubleSolenoid(0, 1, PneumaticsModuleType.REV_PH, 100, 1));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInvalidReversePort() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new DoubleSolenoid(0, 1, PneumaticsModuleType.REVPH, 0, 100));
|
||||
() -> new DoubleSolenoid(0, 1, PneumaticsModuleType.REV_PH, 0, 100));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.wpilib.hardware.hal.util.AllocationException;
|
||||
class SolenoidTestCTRE {
|
||||
@Test
|
||||
void testValidInitialization() {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.CTREPCM, 2)) {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2)) {
|
||||
assertEquals(2, solenoid.getChannel());
|
||||
|
||||
solenoid.set(true);
|
||||
@@ -28,17 +28,17 @@ class SolenoidTestCTRE {
|
||||
|
||||
@Test
|
||||
void testDoubleInitialization() {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.CTREPCM, 2)) {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2)) {
|
||||
assertThrows(
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.CTREPCM, 2));
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDoubleInitializationFromDoubleSolenoid() {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.CTREPCM, 2, 3)) {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2, 3)) {
|
||||
assertThrows(
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.CTREPCM, 2));
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ class SolenoidTestCTRE {
|
||||
void testInvalidChannel() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class,
|
||||
() -> new Solenoid(0, 3, PneumaticsModuleType.CTREPCM, 100));
|
||||
() -> new Solenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 100));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToggle() {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.CTREPCM, 2)) {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.CTRE_PCM, 2)) {
|
||||
solenoid.set(true);
|
||||
assertTrue(solenoid.get());
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.wpilib.hardware.hal.util.AllocationException;
|
||||
class SolenoidTestREV {
|
||||
@Test
|
||||
void testValidInitialization() {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.REVPH, 2)) {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.REV_PH, 2)) {
|
||||
assertEquals(2, solenoid.getChannel());
|
||||
|
||||
solenoid.set(true);
|
||||
@@ -28,29 +28,29 @@ class SolenoidTestREV {
|
||||
|
||||
@Test
|
||||
void testDoubleInitialization() {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.REVPH, 2)) {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.REV_PH, 2)) {
|
||||
assertThrows(
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.REVPH, 2));
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.REV_PH, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testDoubleInitializationFromDoubleSolenoid() {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.REVPH, 2, 3)) {
|
||||
try (DoubleSolenoid solenoid = new DoubleSolenoid(0, 3, PneumaticsModuleType.REV_PH, 2, 3)) {
|
||||
assertThrows(
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.REVPH, 2));
|
||||
AllocationException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.REV_PH, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void testInvalidChannel() {
|
||||
assertThrows(
|
||||
IllegalArgumentException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.REVPH, 100));
|
||||
IllegalArgumentException.class, () -> new Solenoid(0, 3, PneumaticsModuleType.REV_PH, 100));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testToggle() {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.REVPH, 2)) {
|
||||
try (Solenoid solenoid = new Solenoid(0, 3, PneumaticsModuleType.REV_PH, 2)) {
|
||||
solenoid.set(true);
|
||||
assertTrue(solenoid.get());
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ class CTREPCMSimTest {
|
||||
HAL.initialize(500, 0);
|
||||
|
||||
try (PneumaticsControlModule pcm = new PneumaticsControlModule(0);
|
||||
DoubleSolenoid doubleSolenoid = new DoubleSolenoid(0, PneumaticsModuleType.CTREPCM, 3, 4)) {
|
||||
DoubleSolenoid doubleSolenoid =
|
||||
new DoubleSolenoid(0, PneumaticsModuleType.CTRE_PCM, 3, 4)) {
|
||||
CTREPCMSim sim = new CTREPCMSim(0);
|
||||
sim.resetData();
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class REVPHSimTest {
|
||||
HAL.initialize(500, 0);
|
||||
|
||||
try (PneumaticHub ph = new PneumaticHub(1);
|
||||
DoubleSolenoid doubleSolenoid = new DoubleSolenoid(1, PneumaticsModuleType.REVPH, 3, 4)) {
|
||||
DoubleSolenoid doubleSolenoid = new DoubleSolenoid(1, PneumaticsModuleType.REV_PH, 3, 4)) {
|
||||
REVPHSim sim = new REVPHSim(ph);
|
||||
sim.resetData();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user