[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
This commit is contained in:
sciencewhiz
2023-06-15 08:14:35 -07:00
committed by GitHub
parent c3e04a6ea2
commit 5c2addda0f
9 changed files with 497 additions and 18 deletions

View File

@@ -4,6 +4,7 @@
package edu.wpi.first.hal; package edu.wpi.first.hal;
/** REV Pneumatic Hub (PH) HAL JNI functions. */
public class REVPHJNI extends JNIWrapper { public class REVPHJNI extends JNIWrapper {
public static final int COMPRESSOR_CONFIG_TYPE_DISABLED = 0; public static final int COMPRESSOR_CONFIG_TYPE_DISABLED = 0;
public static final int COMPRESSOR_CONFIG_TYPE_DIGITAL = 1; public static final int COMPRESSOR_CONFIG_TYPE_DIGITAL = 1;

View File

@@ -9,7 +9,7 @@
#include "hal/Types.h" #include "hal/Types.h"
/** /**
* @defgroup hal_ctre_pcm CTRE PCM Functions * @defgroup hal_ctre_pcm CTRE Pneumatic Control Module (PCM) Functions
* @ingroup hal_capi * @ingroup hal_capi
* @{ * @{
*/ */
@@ -18,51 +18,232 @@
extern "C" { extern "C" {
#endif #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, HAL_CTREPCMHandle HAL_InitializeCTREPCM(int32_t module,
const char* allocationLocation, const char* allocationLocation,
int32_t* status); int32_t* status);
/**
* Frees a PCM handle.
*
* @param[in] handle the PCMhandle
*/
void HAL_FreeCTREPCM(HAL_CTREPCMHandle handle); 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); 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); 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, void HAL_SetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle, HAL_Bool enabled,
int32_t* status); 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, HAL_Bool HAL_GetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle,
int32_t* status); 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, HAL_Bool HAL_GetCTREPCMPressureSwitch(HAL_CTREPCMHandle handle,
int32_t* status); 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, double HAL_GetCTREPCMCompressorCurrent(HAL_CTREPCMHandle handle,
int32_t* status); 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, HAL_Bool HAL_GetCTREPCMCompressorCurrentTooHighFault(HAL_CTREPCMHandle handle,
int32_t* status); 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_Bool HAL_GetCTREPCMCompressorCurrentTooHighStickyFault(
HAL_CTREPCMHandle handle, int32_t* status); 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, HAL_Bool HAL_GetCTREPCMCompressorShortedStickyFault(HAL_CTREPCMHandle handle,
int32_t* status); 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, HAL_Bool HAL_GetCTREPCMCompressorShortedFault(HAL_CTREPCMHandle handle,
int32_t* status); 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_Bool HAL_GetCTREPCMCompressorNotConnectedStickyFault(
HAL_CTREPCMHandle handle, int32_t* status); 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, HAL_Bool HAL_GetCTREPCMCompressorNotConnectedFault(HAL_CTREPCMHandle handle,
int32_t* status); 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); 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, void HAL_SetCTREPCMSolenoids(HAL_CTREPCMHandle handle, int32_t mask,
int32_t values, int32_t* status); 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 HAL_GetCTREPCMSolenoidDisabledList(HAL_CTREPCMHandle handle,
int32_t* status); 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, HAL_Bool HAL_GetCTREPCMSolenoidVoltageStickyFault(HAL_CTREPCMHandle handle,
int32_t* status); 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, HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault(HAL_CTREPCMHandle handle,
int32_t* status); int32_t* status);
/** Clears all sticky faults on this device. */
void HAL_ClearAllCTREPCMStickyFaults(HAL_CTREPCMHandle handle, int32_t* status); 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, void HAL_FireCTREPCMOneShot(HAL_CTREPCMHandle handle, int32_t index,
int32_t* status); 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, void HAL_SetCTREPCMOneShotDuration(HAL_CTREPCMHandle handle, int32_t index,
int32_t durMs, int32_t* status); int32_t durMs, int32_t* status);

View File

@@ -9,7 +9,7 @@
#include "hal/Types.h" #include "hal/Types.h"
/** /**
* @defgroup hal_rev_ph REV PH Functions * @defgroup hal_rev_ph REV Pneumatic Hub (PH) Functions
* @ingroup hal_capi * @ingroup hal_capi
* @{ * @{
*/ */
@@ -91,58 +91,279 @@ struct HAL_REVPHStickyFaults {
extern "C" { extern "C" {
#endif #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, HAL_REVPHHandle HAL_InitializeREVPH(int32_t module,
const char* allocationLocation, const char* allocationLocation,
int32_t* status); int32_t* status);
/**
* Frees a PH handle.
*
* @param[in] handle the PH handle
*/
void HAL_FreeREVPH(HAL_REVPHHandle 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); 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); 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); 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, void HAL_SetREVPHCompressorConfig(HAL_REVPHHandle handle,
const HAL_REVPHCompressorConfig* config, const HAL_REVPHCompressorConfig* config,
int32_t* status); 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, void HAL_SetREVPHClosedLoopControlDisabled(HAL_REVPHHandle handle,
int32_t* status); 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, void HAL_SetREVPHClosedLoopControlDigital(HAL_REVPHHandle handle,
int32_t* status); 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, void HAL_SetREVPHClosedLoopControlAnalog(HAL_REVPHHandle handle,
double minAnalogVoltage, double minAnalogVoltage,
double maxAnalogVoltage, double maxAnalogVoltage,
int32_t* status); 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, void HAL_SetREVPHClosedLoopControlHybrid(HAL_REVPHHandle handle,
double minAnalogVoltage, double minAnalogVoltage,
double maxAnalogVoltage, double maxAnalogVoltage,
int32_t* status); 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_REVPHCompressorConfigType HAL_GetREVPHCompressorConfig(
HAL_REVPHHandle handle, int32_t* status); 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); 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); 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, double HAL_GetREVPHAnalogVoltage(HAL_REVPHHandle handle, int32_t channel,
int32_t* status); 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); 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); 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); 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); 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, void HAL_GetREVPHVersion(HAL_REVPHHandle handle, HAL_REVPHVersion* version,
int32_t* status); 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); 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, void HAL_SetREVPHSolenoids(HAL_REVPHHandle handle, int32_t mask, int32_t values,
int32_t* status); 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, void HAL_FireREVPHOneShot(HAL_REVPHHandle handle, int32_t index, int32_t durMs,
int32_t* status); 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, void HAL_GetREVPHFaults(HAL_REVPHHandle handle, HAL_REVPHFaults* faults,
int32_t* status); 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, void HAL_GetREVPHStickyFaults(HAL_REVPHHandle handle,
HAL_REVPHStickyFaults* stickyFaults, HAL_REVPHStickyFaults* stickyFaults,
int32_t* status); 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); void HAL_ClearREVPHStickyFaults(HAL_REVPHHandle handle, int32_t* status);
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -98,7 +98,7 @@ class DoubleSolenoid : public wpi::Sendable,
* If a solenoid is shorted, it is added to the DisabledList and disabled * If a solenoid is shorted, it is added to the DisabledList and disabled
* until power cycle, or until faults are cleared. * until power cycle, or until faults are cleared.
* *
* @see ClearAllPCMStickyFaults() * @see ClearAllStickyFaults()
* @return If solenoid is disabled due to short. * @return If solenoid is disabled due to short.
*/ */
bool IsFwdSolenoidDisabled() const; 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 * If a solenoid is shorted, it is added to the DisabledList and disabled
* until power cycle, or until faults are cleared. * until power cycle, or until faults are cleared.
* *
* @see ClearAllPCMStickyFaults() * @see ClearAllStickyFaults()
* @return If solenoid is disabled due to short. * @return If solenoid is disabled due to short.
*/ */
bool IsRevSolenoidDisabled() const; bool IsRevSolenoidDisabled() const;

View File

@@ -117,15 +117,15 @@ class PneumaticsBase {
/** /**
* Sets solenoids on a pneumatics module. * Sets solenoids on a pneumatics module.
* *
* @param mask mask * @param mask bitmask to set
* @param values values * @param values solenoid values
*/ */
virtual void SetSolenoids(int mask, int values) = 0; virtual void SetSolenoids(int mask, int values) = 0;
/** /**
* Gets a bitmask of solenoid values. * Gets a bitmask of solenoid values.
* *
* @return values * @return solenoid values
*/ */
virtual int GetSolenoids() const = 0; virtual int GetSolenoids() const = 0;
@@ -183,8 +183,16 @@ class PneumaticsBase {
*/ */
virtual void UnreserveSolenoids(int mask) = 0; virtual void UnreserveSolenoids(int mask) = 0;
/**
* Reserve the compressor.
*
* @return true if successful; false if compressor already reserved
*/
virtual bool ReserveCompressor() = 0; virtual bool ReserveCompressor() = 0;
/**
* Unreserve the compressor.
*/
virtual void UnreserveCompressor() = 0; virtual void UnreserveCompressor() = 0;
/** /**
@@ -212,9 +220,29 @@ class PneumaticsBase {
*/ */
virtual units::pounds_per_square_inch_t GetPressure(int channel) const = 0; 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; 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, virtual DoubleSolenoid MakeDoubleSolenoid(int forwardChannel,
int reverseChannel) = 0; int reverseChannel) = 0;
/**
* Create a compressor object.
*
* @return Compressor object
*/
virtual Compressor MakeCompressor() = 0; virtual Compressor MakeCompressor() = 0;
/** /**

View File

@@ -118,7 +118,7 @@ class PneumaticsControlModule : public PneumaticsBase {
/** /**
* Returns whether the compressor has been disconnected since sticky faults * Returns whether the compressor has been disconnected since sticky faults
* were last cleared. This fault is persistent and can be cleared by * 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 * @return True if the compressor has been disconnected since sticky faults
* were last cleared, otherwise false. * were last cleared, otherwise false.
@@ -126,7 +126,22 @@ class PneumaticsControlModule : public PneumaticsBase {
*/ */
bool GetCompressorNotConnectedStickyFault() const; 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; 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; bool GetSolenoidVoltageStickyFault() const;
/** Clears all sticky faults on this device. */ /** Clears all sticky faults on this device. */

View File

@@ -87,18 +87,22 @@ class Solenoid : public wpi::Sendable, public wpi::SendableHelper<Solenoid> {
bool IsDisabled() const; bool IsDisabled() const;
/** /**
* Set the pulse duration in the PCM. This is used in conjunction with * Set the pulse duration in the pneumatics module. This is used in
* the startPulse method to allow the PCM to control the timing of a pulse. * conjunction with the startPulse method to allow the pneumatics module to
* The timing can be controlled in 0.01 second increments. * 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() * @see startPulse()
*/ */
void SetPulseDuration(units::second_t duration); 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. * setPulseDuration.
* *
* @see setPulseDuration() * @see setPulseDuration()

View File

@@ -211,16 +211,40 @@ public interface PneumaticsBase extends AutoCloseable {
*/ */
void unreserveSolenoids(int mask); void unreserveSolenoids(int mask);
/**
* Reserve the compressor.
*
* @return true if successful; false if compressor already reserved
*/
boolean reserveCompressor(); boolean reserveCompressor();
/** Unreserve the compressor. */
void unreserveCompressor(); void unreserveCompressor();
@Override @Override
void close(); void close();
/**
* Create a solenoid object for the specified channel.
*
* @param channel solenoid channel
* @return Solenoid object
*/
Solenoid makeSolenoid(int channel); 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); DoubleSolenoid makeDoubleSolenoid(int forwardChannel, int reverseChannel);
/**
* Create a compressor object.
*
* @return Compressor object
*/
Compressor makeCompressor(); Compressor makeCompressor();
} }

View File

@@ -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 * Set the pulse duration in the pneumatics module. This is used in conjunction with the
* allow the PCM to control the timing of a pulse. The timing can be controlled in 0.01 second * startPulse method to allow the pneumatics module to control the timing of a pulse.
* increments.
* *
* @param durationSeconds The duration of the pulse, from 0.01 to 2.55 seconds. * <p>On the PCM, the timing can be controlled in 0.01 second increments, with a maximum of 2.55
* seconds.
*
* <p>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() * @see #startPulse()
*/ */
public void setPulseDuration(double durationSeconds) { 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) * @see #setPulseDuration(double)
*/ */