Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.wpi.first.wpilibj
Class Compressor

    java.lang.Object
      edu.wpi.first.wpilibj.SensorBase
          edu.wpi.first.wpilibj.Compressor

All Implemented Interfaces:
  LiveWindowSendable, IDevice, Sendable

    public class Compressor

extends SensorBase
implements IDevice, LiveWindowSendable

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 background 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`

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.
`String` | `getSmartDashboardType()`
`ITable` | `getTable()`
`void` | `initTable(ITable subtable)` Initializes a table for this sendable object.
`void` | `setRelayValue(Relay.Value relayValue)` Operate the relay for the compressor.
`void` | `start()` Start the compressor.
`void` | `startLiveWindowMode()` Start having this sendable object automatically respond to value changes reflect the value on the table.
`void` | `stop()` Stop the compressor.
`void` | `stopLiveWindowMode()` Stop having this sendable object automatically respond to value changes.
`void` | `updateTable()` Update the table for this sendable object with the latest values.

Methods inherited from class edu.wpi.first.wpilibj.SensorBase
`checkAnalogChannel, checkAnalogModule, checkDigitalChannel, checkDigitalModule, checkPWMChannel, checkPWMModule, checkRelayChannel, checkRelayModule, checkSolenoidChannel, checkSolenoidModule, getDefaultAnalogModule, getDefaultDigitalModule, getDefaultSolenoidModule, setDefaultAnalogModule, setDefaultDigitalModule, setDefaultSolenoidModule`

Methods inherited from class java.lang.Object
`equals, 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.

### getSmartDashboardType

    public String getSmartDashboardType()

  Specified by:
    `getSmartDashboardType` in interface `Sendable`
  Returns:
    the string representation of the named data type that will be used by the smart dashboard for this sendable

### initTable

    public void initTable(ITable subtable)

  Initializes a table for this sendable object.

  Specified by:
    `initTable` in interface `Sendable`
  Parameters:
    `subtable` - The table to put the values in.

### getTable

    public ITable getTable()

  Specified by:
    `getTable` in interface `Sendable`
  Returns:
    the table that is currently associated with the sendable

### updateTable

    public void updateTable()

  Update the table for this sendable object with the latest values.

  Specified by:
    `updateTable` in interface `LiveWindowSendable`

### startLiveWindowMode

    public void startLiveWindowMode()

  Start having this sendable object automatically respond to value changes reflect the value on the table.

  Specified by:
    `startLiveWindowMode` in interface `LiveWindowSendable`

### stopLiveWindowMode

    public void stopLiveWindowMode()

  Stop having this sendable object automatically respond to value changes.

  Specified by:
    `stopLiveWindowMode` in interface `LiveWindowSendable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| " 2013 FRC Java API "
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

"
For updated information see the Java FRC site
"