public class Compressor extends SendableBase implements Sendable
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.
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.
Constructor and Description |
---|
Compressor()
Makes a new instance of the compressor using the default PCM ID of 0.
|
Compressor(int module)
Makes a new instance of the compressor using the provided CAN device ID.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAllPCMStickyFaults()
Clear ALL sticky faults inside PCM that Compressor is wired to.
|
boolean |
enabled()
Get the status of the compressor.
|
boolean |
getClosedLoopControl()
Gets the current operating mode of the PCM.
|
double |
getCompressorCurrent()
Get the current being used by the compressor.
|
boolean |
getCompressorCurrentTooHighFault()
If PCM is in fault state : Compressor Drive is disabled due to compressor current being too
high.
|
boolean |
getCompressorCurrentTooHighStickyFault()
If PCM sticky fault is set : Compressor is disabled due to compressor current being too
high.
|
boolean |
getCompressorNotConnectedFault()
If PCM is in fault state : Compressor does not appear to be wired, i.e.
|
boolean |
getCompressorNotConnectedStickyFault()
If PCM sticky fault is set : Compressor does not appear to be wired, i.e.
|
boolean |
getCompressorShortedFault()
If PCM is in fault state : Compressor output appears to be shorted.
|
boolean |
getCompressorShortedStickyFault()
If PCM sticky fault is set : Compressor output appears to be shorted.
|
boolean |
getPressureSwitchValue()
Get the pressure switch value.
|
void |
initSendable(SendableBuilder builder)
Initializes this
Sendable object. |
void |
setClosedLoopControl(boolean on)
Set the PCM in closed loop control mode.
|
void |
start()
Start the compressor running in closed loop control mode.
|
void |
stop()
Stop the compressor from running in closed loop control mode.
|
addChild, free, getName, getSubsystem, setName, setName, setName, setSubsystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getSubsystem, setName, setName, setSubsystem
public Compressor(int module)
module
- The PCM CAN device ID (0 - 62 inclusive)public Compressor()
Additional modules can be supported by making a new instance and specifying the CAN ID.
public void start()
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()
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 boolean enabled()
public boolean getPressureSwitchValue()
public double getCompressorCurrent()
public void setClosedLoopControl(boolean on)
on
- if true sets the compressor to be in closed loop control mode (default)public boolean getClosedLoopControl()
public boolean getCompressorCurrentTooHighFault()
public boolean getCompressorCurrentTooHighStickyFault()
public boolean getCompressorShortedStickyFault()
public boolean getCompressorShortedFault()
public boolean getCompressorNotConnectedStickyFault()
public boolean getCompressorNotConnectedFault()
public void clearAllPCMStickyFaults()
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.
If no sticky faults are set then this call will have no effect.
public void initSendable(SendableBuilder builder)
Sendable
Sendable
object.initSendable
in interface Sendable
builder
- sendable builder