org.firstinspires.ftc.robotcore.external.navigation

## Class MotionDetection

- java.lang.Object
- - org.firstinspires.ftc.robotcore.external.navigation.MotionDetection

-     public class MotionDetection
      extends java.lang.Object

  A class that will notify listeners when a phone is in motion.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `MotionDetection.MotionDetectionListener`
    `class` | `MotionDetection.Vector`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected MotionDetection.Vector` | `gravity`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MotionDetection()`
    `MotionDetection(double detectionThreshold, int rateLimitSeconds)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected MotionDetection.Vector` | `filter(SensorEvent sensorEvent)` filter Taken straight from the google documentation for implementing a low pass filter for filtering out gravity.
    `boolean` | `isAvailable()` Is the required sensor available on this device?
    `protected void` | `notifyListeners(double vector)`
    `void` | `onAccuracyChanged(Sensor sensor, int i)`
    `void` | `onSensorChanged(SensorEvent sensorEvent)` Internal implementations of the SensorEventListener interface.
    `void` | `purgeListeners()` purgeListeners
    `void` | `registerListener(MotionDetection.MotionDetectionListener listener)` registerListener
    `void` | `startListening()` Start processing sensor data.
    `void` | `stopListening()` Stop processing sensor data.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### gravity

          protected MotionDetection.Vector gravity

  - ### Constructor Detail

    - #### MotionDetection

          public MotionDetection()

    - #### MotionDetection

          public MotionDetection(double detectionThreshold,
                                 int rateLimitSeconds)

  - ### Method Detail

    - #### filter

          protected MotionDetection.Vector filter(SensorEvent sensorEvent)

      filter Taken straight from the google documentation for implementing a low pass filter for filtering out gravity. See https://developer.android.com/reference/android/hardware/SensorEvent#values
      Parameters:
        `sensorEvent` - The sensor data spit out by android for the accelerometer.
      Returns:
        a Vector filtered of gravity's influence.

    - #### registerListener

          public void registerListener(MotionDetection.MotionDetectionListener listener)

      registerListener

    - #### purgeListeners

          public void purgeListeners()

      purgeListeners

    - #### isAvailable

          public boolean isAvailable()

      Is the required sensor available on this device?

    - #### startListening

          public void startListening()

      Start processing sensor data.

    - #### stopListening

          public void stopListening()

      Stop processing sensor data.

    - #### notifyListeners

          protected void notifyListeners(double vector)

    - #### onSensorChanged

          public void onSensorChanged(SensorEvent sensorEvent)

      Internal implementations of the SensorEventListener interface.

    - #### onAccuracyChanged

          public void onAccuracyChanged(Sensor sensor,
                                        int i)