Package lejos.robotics
Class GyroscopeAdapter
- java.lang.Object
-
- lejos.robotics.GyroscopeAdapter
-
-
Constructor Summary
Constructors Constructor Description GyroscopeAdapter(SampleProvider source, float sampleFrequency)GyroscopeAdapter(SampleProvider source, float sampleFrequency, int axisIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetAngle()floatgetAngularVelocity()Implementor must calculate and return the angular velocity in degrees per second.voidrecalibrateOffset()Racalibrates the gyroscope for offset error.voidreset()
-
-
-
Constructor Detail
-
GyroscopeAdapter
public GyroscopeAdapter(SampleProvider source, float sampleFrequency, int axisIndex)
- Parameters:
source- A SampleProvider representing a gyroscopesampleFrequency- The frequency used to sample the gyroscopeaxisIndex- The axis to use (usefull with multiaxis gyroscopes
-
GyroscopeAdapter
public GyroscopeAdapter(SampleProvider source, float sampleFrequency)
- Parameters:
source- A SampleProvider representing a gyroscopesampleFrequency- The frequency used to sample the gyroscope
-
-
Method Detail
-
getAngularVelocity
public float getAngularVelocity()
Description copied from interface:GyroscopeImplementor must calculate and return the angular velocity in degrees per second.- Specified by:
getAngularVelocityin interfaceGyroscope- 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:
recalibrateOffsetin interfaceGyroscope
-
-