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 Accelerometer

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

All Implemented Interfaces:
  LiveWindowSendable, IDevice, ISensor, PIDSource, Sendable

    public class Accelerometer

extends SensorBase
implements PIDSource, ISensor, LiveWindowSendable

Handle operation of the accelerometer. The accelerometer reads acceleration directly through the sensor. Many sensors have multiple axis and can be treated as multiple devices. Each is calibrated by finding the center value over a period of time.

Nested Class Summary

Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj.PIDSource
`PIDSource.PIDSourceParameter`

Field Summary

Fields inherited from class edu.wpi.first.wpilibj.SensorBase
`kAnalogChannels, kAnalogModules, kDigitalChannels, kPwmChannels, kRelayChannels, kSolenoidChannels, kSolenoidModules, kSystemClockTicksPerMicrosecond`

Constructor Summary
`Accelerometer(AnalogChannel channel)` Create a new instance of Accelerometer from an existing AnalogChannel.
`Accelerometer(int channel)` Create a new instance of an accelerometer.
`Accelerometer(int slot, int channel)` Create new instance of accelerometer.

Method Summary
`void` | `free()` Delete the analog components used for the accelerometer.
`double` | `getAcceleration()` Return the acceleration in Gs.
`String` | `getSmartDashboardType()`
`ITable` | `getTable()`
`void` | `initTable(ITable subtable)` Initializes a table for this sendable object.
`double` | `pidGet()` Get the Acceleration for the PID Source parent.
`void` | `setSensitivity(double sensitivity)` Set the accelerometer sensitivity.
`void` | `setZero(double zero)` Set the voltage that corresponds to 0 G.
`void` | `startLiveWindowMode()` Analog Channels don't have to do anything special when entering the LiveWindow.
`void` | `stopLiveWindowMode()` Analog Channels don't have to do anything special when exiting the LiveWindow.
`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

### Accelerometer

    public Accelerometer(int channel)

  Create a new instance of an accelerometer. The accelerometer is assumed to be in the first analog module in the given analog channel. The constructor allocates desired analog channel.

  Parameters:
    `channel` - the port that the accelerometer is on on the default module

### Accelerometer

    public Accelerometer(int slot,
                         int channel)

  Create new instance of accelerometer. Make a new instance of the accelerometer given a module and channel. The constructor allocates the desired analog channel from the specified module

  Parameters:
    `slot` - the slot that the module is in
    `channel` - the port that the Accelerometer is on on the module

### Accelerometer

    public Accelerometer(AnalogChannel channel)

  Create a new instance of Accelerometer from an existing AnalogChannel. Make a new instance of accelerometer given an AnalogChannel. This is particularly useful if the port is going to be read as an analog channel as well as through the Accelerometer class.

  Parameters:
    `channel` - an already initialized analog channel

Method Detail

### free

    public void free()

  Delete the analog components used for the accelerometer.

  Overrides:
    `free` in class `SensorBase`

### getAcceleration

    public double getAcceleration()

  Return the acceleration in Gs. The acceleration is returned units of Gs.

  Returns:
    The current acceleration of the sensor in Gs.

### setSensitivity

    public void setSensitivity(double sensitivity)

  Set the accelerometer sensitivity. This sets the sensitivity of the accelerometer used for calculating the acceleration. The sensitivity varies by accelerometer model.

  Parameters:
    `sensitivity` - The sensitivity of accelerometer in Volts per G.

### setZero

    public void setZero(double zero)

  Set the voltage that corresponds to 0 G. The zero G voltage varies by accelerometer model.

  Parameters:
    `zero` - The zero G voltage.

### pidGet

    public double pidGet()

  Get the Acceleration for the PID Source parent.

  Specified by:
    `pidGet` in interface `PIDSource`
  Returns:
    The current acceleration in Gs.

### 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()

  Analog Channels don't have to do anything special when entering the LiveWindow. 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()

  Analog Channels don't have to do anything special when exiting the LiveWindow. 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
"