Class BuiltInAccelerometer

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

public class BuiltInAccelerometer extends Object implements 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 final void setRange(BuiltInAccelerometer.Range range)
      Set the measuring range of the accelerometer.
      Parameters:
      range - The maximum acceleration, positive or negative, that the accelerometer will measure.
    • getX

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

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

      public double getZ()
      The acceleration in the Z axis.
      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