edu.wpi.first.wpilibj
Class Compressor

java.lang.Object
  extended by edu.wpi.first.wpilibj.SensorBase
      extended by edu.wpi.first.wpilibj.Compressor
All Implemented Interfaces:
IDevice, FrcBotSimComponent

public class Compressor
extends SensorBase
implements IDevice

Compressor object. The Compressor object is designed to handle the operation of the compressor, pressure sensor and relay for a FIRST robot pneumatics system. The Compressor object starts a task which runs in the backround and periodically polls the pressure sensor and operates the relay that controls the compressor.


Field Summary
 
Fields inherited from class edu.wpi.first.wpilibj.SensorBase
kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond, n_simProperties
 
Constructor Summary
Compressor(int pressureSwitchChannel, int compressorRelayChannel)
          Compressor constructor.
Compressor(int pressureSwitchSlot, int pressureSwitchChannel, int compresssorRelaySlot, int compressorRelayChannel)
          Compressor constructor.
 
Method Summary
 boolean enabled()
          Get the state of the enabled flag.
 void free()
          Delete the Compressor object.
 boolean getPressureSwitchValue()
          Get the pressure switch value.
 void setRelayValue(Relay.Value relayValue)
          Operate the relay for the compressor.
 void start()
          Start the compressor.
 void stop()
          Stop the compressor.
 
Methods inherited from class edu.wpi.first.wpilibj.SensorBase
checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, getSimProperties, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compressor

public Compressor(int pressureSwitchSlot,
                  int pressureSwitchChannel,
                  int compresssorRelaySlot,
                  int compressorRelayChannel)
Compressor constructor. Given a fully specified relay channel and pressure switch channel, initialize the Compressor object. You MUST start the compressor by calling the start() method.

Parameters:
pressureSwitchSlot - The module that the pressure switch is attached to.
pressureSwitchChannel - The GPIO channel that the pressure switch is attached to.
compresssorRelaySlot - The module that the compressor relay is attached to.
compressorRelayChannel - The relay channel that the compressor relay is attached to.

Compressor

public Compressor(int pressureSwitchChannel,
                  int compressorRelayChannel)
Compressor constructor. Given a relay channel and pressure switch channel (both in the default digital module), initialize the Compressor object. You MUST start the compressor by calling the start() method.

Parameters:
pressureSwitchChannel - The GPIO channel that the pressure switch is attached to.
compressorRelayChannel - The relay channel that the compressor relay is attached to.
Method Detail

free

public void free()
Delete the Compressor object. Delete the allocated resources for the compressor and kill the compressor task that is polling the pressure switch.

Overrides:
free in class SensorBase

setRelayValue

public void setRelayValue(Relay.Value relayValue)
Operate the relay for the compressor. Change the value of the relay output that is connected to the compressor motor. This is only intended to be called by the internal polling thread.

Parameters:
relayValue - the value to set the relay to

getPressureSwitchValue

public boolean getPressureSwitchValue()
Get the pressure switch value. Read the pressure switch digital input.

Returns:
The current state of the pressure switch.

start

public void start()
Start the compressor. This method will allow the polling loop to actually operate the compressor. The is stopped by default and won't operate until starting it.


stop

public void stop()
Stop the compressor. This method will stop the compressor from turning on.


enabled

public boolean enabled()
Get the state of the enabled flag. Return the state of the enabled flag for the compressor and pressure switch combination.

Returns:
The state of the compressor thread's enable flag.