Class AccelerometerJNI

java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.AccelerometerJNI

public class AccelerometerJNI
extends JNIWrapper
Accelerometer HAL JNI methods.
See Also:
"hal/Accelerometer.h"
  • Constructor Details

  • Method Details

    • setAccelerometerActive

      public static void setAccelerometerActive​(boolean active)
      Sets the accelerometer to active or standby mode.

      It must be in standby mode to change any configuration.

      Parameters:
      active - true to set to active, false for standby
      See Also:
      "HAL_SetAccelerometerActive"
    • setAccelerometerRange

      public static void setAccelerometerRange​(int range)
      Sets the range of values that can be measured (either 2, 4, or 8 g-forces).

      The accelerometer should be in standby mode when this is called.

      Parameters:
      range - the accelerometer range
      See Also:
      "HAL_SetAccelerometerRange(int range)"
    • getAccelerometerX

      public static double getAccelerometerX()
      Gets the x-axis acceleration.

      This is a floating point value in units of 1 g-force.

      Returns:
      the X acceleration
      See Also:
      "HAL_GetAccelerometerX()"
    • getAccelerometerY

      public static double getAccelerometerY()
      Gets the y-axis acceleration.

      This is a floating point value in units of 1 g-force.

      Returns:
      the Y acceleration
      See Also:
      "HAL_GetAccelerometerY()"
    • getAccelerometerZ

      public static double getAccelerometerZ()
      Gets the z-axis acceleration.

      This is a floating point value in units of 1 g-force.

      Returns:
      the Z acceleration
      See Also:
      "HAL_GetAccelerometerZ()"