mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Update Compressor documentation (#244)
This commit is contained in:
committed by
Peter Johnson
parent
5d2a08443b
commit
28e178b1a8
@@ -12,62 +12,67 @@ import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
|
||||
import edu.wpi.first.wpilibj.tables.ITable;
|
||||
|
||||
/**
|
||||
* Class for operating the PCM (Pneumatics compressor module) The PCM automatically will run in
|
||||
* close-loop mode by default whenever a Solenoid object is created. For most cases the Compressor
|
||||
* object does not need to be instantiated or used in a robot program. This class is only required
|
||||
* in cases where more detailed status or to enable/disable closed loop control. Note: you cannot
|
||||
* operate the compressor directly from this class as doing so would circumvent the safety provided
|
||||
* in using the pressure switch and closed loop control. You can only turn off closed loop control,
|
||||
* thereby stopping the compressor from operating.
|
||||
* Class for operating a compressor connected to a PCM (Pneumatic Control Module). The PCM will
|
||||
* automatically run in closed loop mode by default whenever a {@link Solenoid} object is created.
|
||||
* For most cases, a Compressor object does not need to be instantiated or used in a robot program.
|
||||
* This class is only required in cases where the robot program needs a more detailed status of the
|
||||
* compressor or to enable/disable closed loop control.
|
||||
*
|
||||
* <p>Note: you cannot operate the compressor directly from this class as doing so would circumvent
|
||||
* the safety provided by using the pressure switch and closed loop control. You can only turn off
|
||||
* closed loop control, thereby stopping the compressor from operating.
|
||||
*/
|
||||
public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
private int m_compressorHandle;
|
||||
private byte m_module;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Makes a new instance of the compressor using the provided CAN device ID. Use this constructor
|
||||
* when you have more than one PCM.
|
||||
*
|
||||
* <p>Most robots that use PCM will have a single module. Use this for supporting a second module
|
||||
* other than the default.
|
||||
*
|
||||
* @param module The PCM CAN device ID.
|
||||
* @param module The PCM CAN device ID (0 - 62 inclusive)
|
||||
*/
|
||||
public Compressor(int module) {
|
||||
m_table = null;
|
||||
m_module = (byte)module;
|
||||
m_module = (byte) module;
|
||||
|
||||
m_compressorHandle = CompressorJNI.initializeCompressor((byte) module);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of the Compressor Makes a new instance of the compressor using the default
|
||||
* PCM ID (0). Additional modules can be supported by making a new instance and specifying the CAN
|
||||
* ID.
|
||||
* Makes a new instance of the compressor using the default PCM ID of 0.
|
||||
*
|
||||
* <p>Additional modules can be supported by making a new instance and {@link #Compressor(int)
|
||||
* specifying the CAN ID.}
|
||||
*/
|
||||
public Compressor() {
|
||||
this(getDefaultSolenoidModule());
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the compressor running in closed loop control mode Use the method in cases where you
|
||||
* would like to manually stop and start the compressor for applications such as conserving
|
||||
* battery or making sure that the compressor motor doesn't start during critical operations.
|
||||
* Start the compressor running in closed loop control mode.
|
||||
*
|
||||
* <p>Use the method in cases where you would like to manually stop and start the compressor for
|
||||
* applications such as conserving battery or making sure that the compressor motor doesn't start
|
||||
* during critical operations.
|
||||
*/
|
||||
public void start() {
|
||||
setClosedLoopControl(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the compressor from running in closed loop control mode. Use the method in cases where you
|
||||
* would like to manually stop and start the compressor for applications such as conserving
|
||||
* battery or making sure that the compressor motor doesn't start during critical operations.
|
||||
* Stop the compressor from running in closed loop control mode.
|
||||
*
|
||||
* <p>Use the method in cases where you would like to manually stop and start the compressor for
|
||||
* applications such as conserving battery or making sure that the compressor motor doesn't start
|
||||
* during critical operations.
|
||||
*/
|
||||
public void stop() {
|
||||
setClosedLoopControl(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the enabled status of the compressor.
|
||||
* Get the status of the compressor.
|
||||
*
|
||||
* @return true if the compressor is on
|
||||
*/
|
||||
@@ -76,9 +81,9 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current pressure switch value.
|
||||
* Get the pressure switch value.
|
||||
*
|
||||
* @return true if the pressure is low by reading the pressure switch that is plugged into the PCM
|
||||
* @return true if the pressure is low
|
||||
*/
|
||||
public boolean getPressureSwitchValue() {
|
||||
return CompressorJNI.getCompressorPressureSwitch(m_compressorHandle);
|
||||
@@ -87,7 +92,7 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
/**
|
||||
* Get the current being used by the compressor.
|
||||
*
|
||||
* @return current consumed in amps for the compressor motor
|
||||
* @return current consumed by the compressor in amps
|
||||
*/
|
||||
public float getCompressorCurrent() {
|
||||
return CompressorJNI.getCompressorCurrent(m_compressorHandle);
|
||||
@@ -96,8 +101,7 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
/**
|
||||
* Set the PCM in closed loop control mode.
|
||||
*
|
||||
* @param on If true sets the compressor to be in closed loop control mode otherwise normal
|
||||
* operation of the compressor is disabled.
|
||||
* @param on if true sets the compressor to be in closed loop control mode (default)
|
||||
*/
|
||||
public void setClosedLoopControl(boolean on) {
|
||||
CompressorJNI.setCompressorClosedLoopControl(m_compressorHandle, on);
|
||||
@@ -106,7 +110,7 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
/**
|
||||
* Gets the current operating mode of the PCM.
|
||||
*
|
||||
* @return true if compressor is operating on closed-loop mode, otherwise return false.
|
||||
* @return true if compressor is operating on closed-loop mode
|
||||
*/
|
||||
public boolean getClosedLoopControl() {
|
||||
return CompressorJNI.getCompressorClosedLoopControl(m_compressorHandle);
|
||||
@@ -123,7 +127,7 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
}
|
||||
|
||||
/**
|
||||
* If PCM sticky fault is set : Compressor Drive is disabled due to compressor current being too
|
||||
* If PCM sticky fault is set : Compressor is disabled due to compressor current being too
|
||||
* high.
|
||||
*
|
||||
* @return true if PCM sticky fault is set.
|
||||
@@ -169,8 +173,8 @@ public class Compressor extends SensorBase implements LiveWindowSendable {
|
||||
/**
|
||||
* Clear ALL sticky faults inside PCM that Compressor is wired to.
|
||||
*
|
||||
* <p>If a sticky fault is set, then it will be persistently cleared. Compressor drive maybe
|
||||
* momentarily disable while flags are being cleared. Care should be taken to not call this too
|
||||
* <p>If a sticky fault is set, then it will be persistently cleared. The compressor might
|
||||
* momentarily disable while the flags are being cleared. Doo not call this method too
|
||||
* frequently, otherwise normal compressor functionality may be prevented.
|
||||
*
|
||||
* <p>If no sticky faults are set then this call will have no effect.
|
||||
|
||||
Reference in New Issue
Block a user