From 5c2addda0f2ecb2efb3497e4bb204173b8703bbd Mon Sep 17 00:00:00 2001 From: sciencewhiz Date: Thu, 15 Jun 2023 08:14:35 -0700 Subject: [PATCH] [doc] Add missing pneumatics docs (NFC) (#5389) Add missing HAL docs for PCM and PH Fix references to PCM Document different one shot durations for PCM and PH --- .../main/java/edu/wpi/first/hal/REVPHJNI.java | 1 + hal/src/main/native/include/hal/CTREPCM.h | 183 +++++++++++++- hal/src/main/native/include/hal/REVPH.h | 223 +++++++++++++++++- .../main/native/include/frc/DoubleSolenoid.h | 4 +- .../main/native/include/frc/PneumaticsBase.h | 34 ++- .../include/frc/PneumaticsControlModule.h | 17 +- .../src/main/native/include/frc/Solenoid.h | 14 +- .../edu/wpi/first/wpilibj/PneumaticsBase.java | 24 ++ .../java/edu/wpi/first/wpilibj/Solenoid.java | 15 +- 9 files changed, 497 insertions(+), 18 deletions(-) diff --git a/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java b/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java index 44c67a80ff..a4fb92ecee 100644 --- a/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java +++ b/hal/src/main/java/edu/wpi/first/hal/REVPHJNI.java @@ -4,6 +4,7 @@ package edu.wpi.first.hal; +/** REV Pneumatic Hub (PH) HAL JNI functions. */ public class REVPHJNI extends JNIWrapper { public static final int COMPRESSOR_CONFIG_TYPE_DISABLED = 0; public static final int COMPRESSOR_CONFIG_TYPE_DIGITAL = 1; diff --git a/hal/src/main/native/include/hal/CTREPCM.h b/hal/src/main/native/include/hal/CTREPCM.h index 1bed928c63..3cfb5e4b5d 100644 --- a/hal/src/main/native/include/hal/CTREPCM.h +++ b/hal/src/main/native/include/hal/CTREPCM.h @@ -9,7 +9,7 @@ #include "hal/Types.h" /** - * @defgroup hal_ctre_pcm CTRE PCM Functions + * @defgroup hal_ctre_pcm CTRE Pneumatic Control Module (PCM) Functions * @ingroup hal_capi * @{ */ @@ -18,51 +18,232 @@ extern "C" { #endif +/** + * Initializes a PCM. + * + * @param[in] module the CAN ID to initialize + * @param[in] allocationLocation the location where the allocation is occurring + * (can be null) + * @param[out] status Error status variable. 0 on success. + * @return the created PH handle + */ HAL_CTREPCMHandle HAL_InitializeCTREPCM(int32_t module, const char* allocationLocation, int32_t* status); + +/** + * Frees a PCM handle. + * + * @param[in] handle the PCMhandle + */ void HAL_FreeCTREPCM(HAL_CTREPCMHandle handle); +/** + * Checks if a solenoid channel number is valid. + * + * @param[in] channel the channel to check + * @return true if the channel is valid, otherwise false + */ HAL_Bool HAL_CheckCTREPCMSolenoidChannel(int32_t channel); +/** + * Get whether compressor is turned on. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return true if the compressor is turned on + */ HAL_Bool HAL_GetCTREPCMCompressor(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Enables the compressor closed loop control using the digital pressure switch. + * The compressor will turn on when the pressure switch indicates that the + * system is not full, and will turn off when the pressure switch indicates that + * the system is full. + * + * @param[in] handle the PCM handle + * @param[in] enabled true to enable closed loop control + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle, HAL_Bool enabled, int32_t* status); + +/** + * Get whether the PCM closed loop control is enabled. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if closed loop control is enabled, otherwise false. + */ HAL_Bool HAL_GetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns the state of the pressure switch. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if pressure switch indicates that the system is full, + * otherwise false. + */ HAL_Bool HAL_GetCTREPCMPressureSwitch(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns the current drawn by the compressor. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return The current drawn by the compressor in amps. + */ double HAL_GetCTREPCMCompressorCurrent(HAL_CTREPCMHandle handle, int32_t* status); +/** + * Return whether the compressor current is currently too high. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if the compressor current is too high, otherwise false. + * @see HAL_GetCTREPCMCompressorShortedStickyFault + */ HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighFault(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns whether the compressor current has been too high since sticky + * faults were last cleared. This fault is persistent and can be cleared by + * HAL_ClearAllCTREPCMStickyFaults() + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if the compressor current has been too high since sticky + * faults were last cleared. + * @see HAL_GetCTREPCMCompressorCurrentTooHighFault() + */ HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighStickyFault( HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns whether the compressor has been shorted since sticky faults were + * last cleared. This fault is persistent and can be cleared by + * HAL_ClearAllCTREPCMStickyFaults() + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if the compressor has been shorted since sticky faults were + * last cleared, otherwise false. + * @see HAL_GetCTREPCMCompressorShortedFault() + */ HAL_Bool HAL_GetCTREPCMCompressorShortedStickyFault(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns whether the compressor is currently shorted. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if the compressor is currently shorted, otherwise false. + * @see HAL_GetCTREPCMCompressorShortedStickyFault + */ HAL_Bool HAL_GetCTREPCMCompressorShortedFault(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns whether the compressor has been disconnected since sticky faults + * were last cleared. This fault is persistent and can be cleared by + * HAL_ClearAllCTREPCMStickyFaults() + * + * @return True if the compressor has been disconnected since sticky faults + * were last cleared, otherwise false. + * @see HAL_GetCTREPCMCompressorShortedFault() + */ HAL_Bool HAL_GetCTREPCMCompressorNotConnectedStickyFault( HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns whether the compressor is currently disconnected. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if compressor is currently disconnected, otherwise false. + * @see HAL_GetCTREPCMCompressorNotConnectedStickyFault() + */ HAL_Bool HAL_GetCTREPCMCompressorNotConnectedFault(HAL_CTREPCMHandle handle, int32_t* status); +/** + * Gets a bitmask of solenoid values. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return solenoid values + */ int32_t HAL_GetCTREPCMSolenoids(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Sets solenoids on a pneumatics module. + * + * @param[in] handle the PCM handle + * @param[in] mask bitmask to set + * @param[in] values solenoid values + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetCTREPCMSolenoids(HAL_CTREPCMHandle handle, int32_t mask, int32_t values, int32_t* status); +/** + * Get a bitmask of disabled solenoids. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return bitmask of disabled solenoids + */ int32_t HAL_GetCTREPCMSolenoidDisabledList(HAL_CTREPCMHandle handle, int32_t* status); + +/** + * Returns whether the solenoid has reported a voltage fault since sticky faults + * were last cleared. This fault is persistent and can be cleared by + * HAL_ClearAllCTREPCMStickyFaults() + * + * @return True if solenoid is reporting a fault, otherwise false. + * @see HAL_GetCTREPCMSolenoidVoltageFault() + */ HAL_Bool HAL_GetCTREPCMSolenoidVoltageStickyFault(HAL_CTREPCMHandle handle, int32_t* status); +/** + * Returns whether the solenoid is currently reporting a voltage fault. + * + * @param[in] handle the PCM handle + * @param[out] status Error status variable. 0 on success. + * @return True if solenoid is reporting a fault, otherwise false. + * @see HAL_GetCTREPCMSolenoidVoltageStickyFault() + */ HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault(HAL_CTREPCMHandle handle, int32_t* status); +/** Clears all sticky faults on this device. */ void HAL_ClearAllCTREPCMStickyFaults(HAL_CTREPCMHandle handle, int32_t* status); +/** + * Fire a single solenoid shot. + * + * @param[in] handle the PCM handle + * @param[in] index solenoid index + * @param[out] status Error status variable. 0 on success. + */ void HAL_FireCTREPCMOneShot(HAL_CTREPCMHandle handle, int32_t index, int32_t* status); + +/** + * Set the duration for a single solenoid shot. + * + * @param[in] handle the PCM handle + * @param[in] index solenoid index + * @param[in] durMs shot duration in ms + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetCTREPCMOneShotDuration(HAL_CTREPCMHandle handle, int32_t index, int32_t durMs, int32_t* status); diff --git a/hal/src/main/native/include/hal/REVPH.h b/hal/src/main/native/include/hal/REVPH.h index 430c53dc76..0686c9943e 100644 --- a/hal/src/main/native/include/hal/REVPH.h +++ b/hal/src/main/native/include/hal/REVPH.h @@ -9,7 +9,7 @@ #include "hal/Types.h" /** - * @defgroup hal_rev_ph REV PH Functions + * @defgroup hal_rev_ph REV Pneumatic Hub (PH) Functions * @ingroup hal_capi * @{ */ @@ -91,58 +91,279 @@ struct HAL_REVPHStickyFaults { extern "C" { #endif +/** + * Initializes a PH. + * + * @param[in] module the CAN ID to initialize + * @param[in] allocationLocation the location where the allocation is occurring + * (can be null) + * @param[out] status Error status variable. 0 on success. + * @return the created PH handle + */ HAL_REVPHHandle HAL_InitializeREVPH(int32_t module, const char* allocationLocation, int32_t* status); +/** + * Frees a PH handle. + * + * @param[in] handle the PH handle + */ void HAL_FreeREVPH(HAL_REVPHHandle handle); +/** + * Checks if a solenoid channel number is valid. + * + * @param[in] channel the channel to check + * @return true if the channel is valid, otherwise false + */ HAL_Bool HAL_CheckREVPHSolenoidChannel(int32_t channel); + +/** + * Checks if a PH module (CAN ID) is valid. + * + * @param[in] module the module to check + * @return true if the module is valid, otherwise false + */ HAL_Bool HAL_CheckREVPHModuleNumber(int32_t module); +/** + * Get whether compressor is turned on. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return true if the compressor is turned on + */ HAL_Bool HAL_GetREVPHCompressor(HAL_REVPHHandle handle, int32_t* status); + +/** + * Send compressor configuration to the PH. + * + * @param[in] handle the PH handle + * @param[in] config compressor configuration + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetREVPHCompressorConfig(HAL_REVPHHandle handle, const HAL_REVPHCompressorConfig* config, int32_t* status); + +/** + * Disable Compressor. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetREVPHClosedLoopControlDisabled(HAL_REVPHHandle handle, int32_t* status); + +/** + * Enables the compressor in digital mode using the digital pressure switch. The + * compressor will turn on when the pressure switch indicates that the system is + * not full, and will turn off when the pressure switch indicates that the + * system is full. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetREVPHClosedLoopControlDigital(HAL_REVPHHandle handle, int32_t* status); + +/** + * Enables the compressor in analog mode. This mode uses an analog + * pressure sensor connected to analog channel 0 to cycle the compressor. The + * compressor will turn on when the pressure drops below minAnalogVoltage and + * will turn off when the pressure reaches maxAnalogVoltage. This mode is only + * supported by the REV PH with the REV Analog Pressure Sensor connected to + * analog channel 0. + * @param[in] handle the PH handle + * @param[in] minAnalogVoltage The compressor will turn on when the analog + * pressure sensor voltage drops below this value + * @param[in] maxAnalogVoltage The compressor will turn off when the analog + * pressure sensor reaches this value. + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetREVPHClosedLoopControlAnalog(HAL_REVPHHandle handle, double minAnalogVoltage, double maxAnalogVoltage, int32_t* status); + +/** + * Enables the compressor in hybrid mode. This mode uses both a digital + * pressure switch and an analog pressure sensor connected to analog channel 0 + * to cycle the compressor. + * + * The compressor will turn on when \a both: + * + * - The digital pressure switch indicates the system is not full AND + * - The analog pressure sensor indicates that the pressure in the system is + * below the specified minimum pressure. + * + * The compressor will turn off when \a either: + * + * - The digital pressure switch is disconnected or indicates that the system + * is full OR + * - The pressure detected by the analog sensor is greater than the specified + * maximum pressure. + * + * @param[in] handle the PH handle + * @param[in] minAnalogVoltage The compressor will turn on when the analog + * pressure sensor voltage drops below this value and the pressure switch + * indicates that the system is not full. + * @param[in] maxAnalogVoltage The compressor will turn off when the analog + * pressure sensor reaches this value or the pressure switch is disconnected or + * indicates that the system is full. + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetREVPHClosedLoopControlHybrid(HAL_REVPHHandle handle, double minAnalogVoltage, double maxAnalogVoltage, int32_t* status); + +/** + * Get compressor configuration from the PH. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return compressor configuration + */ HAL_REVPHCompressorConfigType HAL_GetREVPHCompressorConfig( HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the state of the digital pressure switch. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return True if pressure switch indicates that the system is full, + * otherwise false. + */ HAL_Bool HAL_GetREVPHPressureSwitch(HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the current drawn by the compressor. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return The current drawn by the compressor in amps. + */ double HAL_GetREVPHCompressorCurrent(HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the raw voltage of the specified analog + * input channel. + * + * @param[in] handle the PH handle + * @param[in] channel The analog input channel to read voltage from. + * @param[out] status Error status variable. 0 on success. + * @return The voltage of the specified analog input channel in volts. + */ double HAL_GetREVPHAnalogVoltage(HAL_REVPHHandle handle, int32_t channel, int32_t* status); + +/** + * Returns the current input voltage for the PH. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return The input voltage in volts. + */ double HAL_GetREVPHVoltage(HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the current voltage of the regulated 5v supply. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return The current voltage of the 5v supply in volts. + */ double HAL_GetREVPH5VVoltage(HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the total current drawn by all solenoids. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return Total current drawn by all solenoids in amps. + */ double HAL_GetREVPHSolenoidCurrent(HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the current voltage of the solenoid power supply. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return The current voltage of the solenoid power supply in volts. + */ double HAL_GetREVPHSolenoidVoltage(HAL_REVPHHandle handle, int32_t* status); + +/** + * Returns the hardware and firmware versions of the PH. + * + * @param[in] handle the PH handle + * @param[out] version The hardware and firmware versions. + * @param[out] status Error status variable. 0 on success. + */ void HAL_GetREVPHVersion(HAL_REVPHHandle handle, HAL_REVPHVersion* version, int32_t* status); +/** + * Gets a bitmask of solenoid values. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + * @return solenoid values + */ int32_t HAL_GetREVPHSolenoids(HAL_REVPHHandle handle, int32_t* status); + +/** + * Sets solenoids on a pneumatics module. + * + * @param[in] handle the PH handle + * @param[in] mask bitmask to set + * @param[in] values solenoid values + * @param[out] status Error status variable. 0 on success. + */ void HAL_SetREVPHSolenoids(HAL_REVPHHandle handle, int32_t mask, int32_t values, int32_t* status); +/** + * Fire a single solenoid shot for the specified duration. + * + * @param[in] handle the PH handle + * @param[in] index solenoid index + * @param[in] durMs shot duration in ms + * @param[out] status Error status variable. 0 on success. + */ void HAL_FireREVPHOneShot(HAL_REVPHHandle handle, int32_t index, int32_t durMs, int32_t* status); +/** + * Returns the faults currently active on the PH. + * + * @param[in] handle the PH handle + * @param[out] faults The faults. + * @param[out] status Error status variable. 0 on success. + */ void HAL_GetREVPHFaults(HAL_REVPHHandle handle, HAL_REVPHFaults* faults, int32_t* status); +/** + * Returns the sticky faults currently active on this device. + * + * @param[in] handle the PH handle + * @param[out] stickyFaults The sticky faults. + * @param[out] status Error status variable. 0 on success. + */ void HAL_GetREVPHStickyFaults(HAL_REVPHHandle handle, HAL_REVPHStickyFaults* stickyFaults, int32_t* status); +/** + * Clears the sticky faults. + * + * @param[in] handle the PH handle + * @param[out] status Error status variable. 0 on success. + */ void HAL_ClearREVPHStickyFaults(HAL_REVPHHandle handle, int32_t* status); #ifdef __cplusplus diff --git a/wpilibc/src/main/native/include/frc/DoubleSolenoid.h b/wpilibc/src/main/native/include/frc/DoubleSolenoid.h index 381e3a1464..f02ba5a194 100644 --- a/wpilibc/src/main/native/include/frc/DoubleSolenoid.h +++ b/wpilibc/src/main/native/include/frc/DoubleSolenoid.h @@ -98,7 +98,7 @@ class DoubleSolenoid : public wpi::Sendable, * If a solenoid is shorted, it is added to the DisabledList and disabled * until power cycle, or until faults are cleared. * - * @see ClearAllPCMStickyFaults() + * @see ClearAllStickyFaults() * @return If solenoid is disabled due to short. */ bool IsFwdSolenoidDisabled() const; @@ -109,7 +109,7 @@ class DoubleSolenoid : public wpi::Sendable, * If a solenoid is shorted, it is added to the DisabledList and disabled * until power cycle, or until faults are cleared. * - * @see ClearAllPCMStickyFaults() + * @see ClearAllStickyFaults() * @return If solenoid is disabled due to short. */ bool IsRevSolenoidDisabled() const; diff --git a/wpilibc/src/main/native/include/frc/PneumaticsBase.h b/wpilibc/src/main/native/include/frc/PneumaticsBase.h index b455dc6178..59f899fabb 100644 --- a/wpilibc/src/main/native/include/frc/PneumaticsBase.h +++ b/wpilibc/src/main/native/include/frc/PneumaticsBase.h @@ -117,15 +117,15 @@ class PneumaticsBase { /** * Sets solenoids on a pneumatics module. * - * @param mask mask - * @param values values + * @param mask bitmask to set + * @param values solenoid values */ virtual void SetSolenoids(int mask, int values) = 0; /** * Gets a bitmask of solenoid values. * - * @return values + * @return solenoid values */ virtual int GetSolenoids() const = 0; @@ -183,8 +183,16 @@ class PneumaticsBase { */ virtual void UnreserveSolenoids(int mask) = 0; + /** + * Reserve the compressor. + * + * @return true if successful; false if compressor already reserved + */ virtual bool ReserveCompressor() = 0; + /** + * Unreserve the compressor. + */ virtual void UnreserveCompressor() = 0; /** @@ -212,9 +220,29 @@ class PneumaticsBase { */ virtual units::pounds_per_square_inch_t GetPressure(int channel) const = 0; + /** + * Create a solenoid object for the specified channel. + * + * @param channel solenoid channel + * @return Solenoid object + */ virtual Solenoid MakeSolenoid(int channel) = 0; + + /** + * Create a double solenoid object for the specified channels. + * + * @param forwardChannel solenoid channel for forward + * @param reverseChannel solenoid channel for reverse + * @return DoubleSolenoid object + */ virtual DoubleSolenoid MakeDoubleSolenoid(int forwardChannel, int reverseChannel) = 0; + + /** + * Create a compressor object. + * + * @return Compressor object + */ virtual Compressor MakeCompressor() = 0; /** diff --git a/wpilibc/src/main/native/include/frc/PneumaticsControlModule.h b/wpilibc/src/main/native/include/frc/PneumaticsControlModule.h index acad5a1255..3dd6d3a8ca 100644 --- a/wpilibc/src/main/native/include/frc/PneumaticsControlModule.h +++ b/wpilibc/src/main/native/include/frc/PneumaticsControlModule.h @@ -118,7 +118,7 @@ class PneumaticsControlModule : public PneumaticsBase { /** * Returns whether the compressor has been disconnected since sticky faults * were last cleared. This fault is persistent and can be cleared by - * ClearAllStickyFaults()} + * ClearAllStickyFaults() * * @return True if the compressor has been disconnected since sticky faults * were last cleared, otherwise false. @@ -126,7 +126,22 @@ class PneumaticsControlModule : public PneumaticsBase { */ bool GetCompressorNotConnectedStickyFault() const; + /** + * Returns whether the solenoid is currently reporting a voltage fault. + * + * @return True if solenoid is reporting a fault, otherwise false. + * @see GetSolenoidVoltageStickyFault() + */ bool GetSolenoidVoltageFault() const; + + /** + * Returns whether the solenoid has reported a voltage fault since sticky + * faults were last cleared. This fault is persistent and can be cleared by + * ClearAllStickyFaults() + * + * @return True if solenoid is reporting a fault, otherwise false. + * @see GetSolenoidVoltageFault() + */ bool GetSolenoidVoltageStickyFault() const; /** Clears all sticky faults on this device. */ diff --git a/wpilibc/src/main/native/include/frc/Solenoid.h b/wpilibc/src/main/native/include/frc/Solenoid.h index a09ffc02b3..7fa49530a1 100644 --- a/wpilibc/src/main/native/include/frc/Solenoid.h +++ b/wpilibc/src/main/native/include/frc/Solenoid.h @@ -87,18 +87,22 @@ class Solenoid : public wpi::Sendable, public wpi::SendableHelper { bool IsDisabled() const; /** - * Set the pulse duration in the PCM. This is used in conjunction with - * the startPulse method to allow the PCM to control the timing of a pulse. - * The timing can be controlled in 0.01 second increments. + * Set the pulse duration in the pneumatics module. This is used in + * conjunction with the startPulse method to allow the pneumatics module to + * control the timing of a pulse. * - * @param duration The duration of the pulse, from 0.01 to 2.55 seconds. + * On the PCM, the timing can be controlled in 0.01 second increments, with a + * maximum of 2.55 seconds. On the PH, the timing can be controlled in 0.001 + * second increments, with a maximum of 65.534 seconds. + * + * @param duration The duration of the pulse. * * @see startPulse() */ void SetPulseDuration(units::second_t duration); /** - * %Trigger the PCM to generate a pulse of the duration set in + * %Trigger the pneumatics module to generate a pulse of the duration set in * setPulseDuration. * * @see setPulseDuration() diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsBase.java index 57dbfc6fe3..d9b493b47c 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PneumaticsBase.java @@ -211,16 +211,40 @@ public interface PneumaticsBase extends AutoCloseable { */ void unreserveSolenoids(int mask); + /** + * Reserve the compressor. + * + * @return true if successful; false if compressor already reserved + */ boolean reserveCompressor(); + /** Unreserve the compressor. */ void unreserveCompressor(); @Override void close(); + /** + * Create a solenoid object for the specified channel. + * + * @param channel solenoid channel + * @return Solenoid object + */ Solenoid makeSolenoid(int channel); + /** + * Create a double solenoid object for the specified channels. + * + * @param forwardChannel solenoid channel for forward + * @param reverseChannel solenoid channel for reverse + * @return DoubleSolenoid object + */ DoubleSolenoid makeDoubleSolenoid(int forwardChannel, int reverseChannel); + /** + * Create a compressor object. + * + * @return Compressor object + */ Compressor makeCompressor(); } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java index bb9be1a0df..be87444ae5 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java @@ -117,11 +117,16 @@ public class Solenoid implements Sendable, AutoCloseable { } /** - * Set the pulse duration in the PCM. This is used in conjunction with the startPulse method to - * allow the PCM to control the timing of a pulse. The timing can be controlled in 0.01 second - * increments. + * Set the pulse duration in the pneumatics module. This is used in conjunction with the + * startPulse method to allow the pneumatics module to control the timing of a pulse. * - * @param durationSeconds The duration of the pulse, from 0.01 to 2.55 seconds. + *

On the PCM, the timing can be controlled in 0.01 second increments, with a maximum of 2.55 + * seconds. + * + *

On the PH, the timing can be controlled in 0.001 second increments, with a maximum of 65.534 + * seconds. + * + * @param durationSeconds The duration of the pulse in seconds. * @see #startPulse() */ public void setPulseDuration(double durationSeconds) { @@ -130,7 +135,7 @@ public class Solenoid implements Sendable, AutoCloseable { } /** - * Trigger the PCM to generate a pulse of the duration set in setPulseDuration. + * Trigger the pneumatics module to generate a pulse of the duration set in setPulseDuration. * * @see #setPulseDuration(double) */