Class GyroscopeAdapter

  • All Implemented Interfaces:
    Gyroscope

    public class GyroscopeAdapter
    extends java.lang.Object
    implements Gyroscope
    Provides an adapter that implements the Gyroscope interface.
    The gyroscope is sampled at a regular interval and its output is integrated into accumulated angle.
    Author:
    Aswin
    • Constructor Detail

      • GyroscopeAdapter

        public GyroscopeAdapter​(SampleProvider source,
                                float sampleFrequency,
                                int axisIndex)
        Parameters:
        source - A SampleProvider representing a gyroscope
        sampleFrequency - The frequency used to sample the gyroscope
        axisIndex - The axis to use (usefull with multiaxis gyroscopes
      • GyroscopeAdapter

        public GyroscopeAdapter​(SampleProvider source,
                                float sampleFrequency)
        Parameters:
        source - A SampleProvider representing a gyroscope
        sampleFrequency - The frequency used to sample the gyroscope
    • Method Detail

      • getAngularVelocity

        public float getAngularVelocity()
        Description copied from interface: Gyroscope
        Implementor must calculate and return the angular velocity in degrees per second.
        Specified by:
        getAngularVelocity in interface Gyroscope
        Returns:
        Angular velocity in degrees/second
      • recalibrateOffset

        public void recalibrateOffset()
        Racalibrates the gyroscope for offset error.
        Calibration takes a second during which the gyroscope must remain motionless.
        Specified by:
        recalibrateOffset in interface Gyroscope
      • reset

        public void reset()
        Specified by:
        reset in interface Gyroscope