Class BuiltInAccelerometer

java.lang.Object
edu.wpi.first.wpilibj.BuiltInAccelerometer
All Implemented Interfaces:
Accelerometer, Sendable, AutoCloseable

public class BuiltInAccelerometer
extends Object
implements Accelerometer, Sendable, AutoCloseable
Built-in accelerometer.

This class allows access to the roboRIO's internal accelerometer.

  • Constructor Details

  • Method Details

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • setRange

      public void setRange​(Accelerometer.Range range)
      Description copied from interface: Accelerometer
      Common interface for setting the measuring range of an accelerometer.
      Specified by:
      setRange in interface Accelerometer
      Parameters:
      range - The maximum acceleration, positive or negative, that the accelerometer will measure. Not all accelerometers support all ranges.
    • getX

      public double getX()
      The acceleration in the X axis.
      Specified by:
      getX in interface Accelerometer
      Returns:
      The acceleration of the roboRIO along the X axis in g-forces
    • getY

      public double getY()
      The acceleration in the Y axis.
      Specified by:
      getY in interface Accelerometer
      Returns:
      The acceleration of the roboRIO along the Y axis in g-forces
    • getZ

      public double getZ()
      The acceleration in the Z axis.
      Specified by:
      getZ in interface Accelerometer
      Returns:
      The acceleration of the roboRIO along the Z axis in g-forces
    • initSendable

      public void initSendable​(SendableBuilder builder)
      Description copied from interface: Sendable
      Initializes this Sendable object.
      Specified by:
      initSendable in interface Sendable
      Parameters:
      builder - sendable builder