public class ModernRoboticsI2cGyro extends I2cDeviceSynchDevice<I2cDeviceSynch> implements GyroSensor, Gyroscope, IntegratingGyroscope, I2cAddrConfig
ModernRoboticsI2cGyro supports the Modern Robotics integrating gyro.
This sensor contains an L3GD20 MEMS three-axis digital output gyroscope. Internally, the chip is labelled (e.g.) "AGD2 2437 JR4IJ".
| Modifier and Type | Class and Description |
|---|---|
static class |
ModernRoboticsI2cGyro.Command |
static class |
ModernRoboticsI2cGyro.HeadingMode
ModernRoboticsI2cGyro.HeadingMode can be used to configure the software to return either cartesian or
cardinal headings. |
static class |
ModernRoboticsI2cGyro.MeasurementMode
Deprecated.
This provides little useful utility beyond
isCalibrating() |
static class |
ModernRoboticsI2cGyro.Register |
HardwareDevice.Manufacturer| Modifier and Type | Field and Description |
|---|---|
static I2cAddr |
ADDRESS_I2C_DEFAULT |
protected float |
degreesPerSecondPerDigit |
protected float |
degreesPerZAxisTick |
protected ModernRoboticsI2cGyro.HeadingMode |
headingMode |
deviceClient, deviceClientIsOwned, isInitialized| Constructor and Description |
|---|
ModernRoboticsI2cGyro(I2cDeviceSynch deviceClient) |
| Modifier and Type | Method and Description |
|---|---|
void |
calibrate()
Calibrate the gyro.
|
protected float |
degreesZFromIntegratedZ(int integratedZ) |
protected boolean |
doInitialize()
Actually carries out the initialization of the instance.
|
Orientation |
getAngularOrientation(AxesReference reference,
AxesOrder order,
AngleUnit angleUnit)
Returns the absolute orientation of the sensor as a set three angles.
|
java.util.Set<Axis> |
getAngularOrientationAxes()
Returns the axes on which the sensor measures angular orientation.
|
AngularVelocity |
getAngularVelocity(AngleUnit unit)
Returns the angular rotation rate across all the axes measured by the gyro.
|
java.util.Set<Axis> |
getAngularVelocityAxes()
Returns the axes on which the gyroscope measures angular velocity.
|
java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
int |
getHeading()
Return the integrated Z axis as a cartesian heading.
|
ModernRoboticsI2cGyro.HeadingMode |
getHeadingMode() |
I2cAddr |
getI2cAddress()
Returns the I2C address currently in use to communicate with an I2C hardware device
|
int |
getIntegratedZValue() |
HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
ModernRoboticsI2cGyro.MeasurementMode |
getMeasurementMode()
Deprecated.
|
double |
getRotationFraction()
Deprecated.
This method has no utility for this gyro.
|
int |
getZAxisOffset() |
int |
getZAxisScalingCoefficient() |
boolean |
isCalibrating()
Is the gyro performing a calibration operation?
|
protected float |
normalize0359(float degrees) |
protected void |
notSupported() |
int |
rawX()
"Gyro Raw Values: The three fields X, Y and Z are the unprocessed values being
obtained from the sensor element.
|
int |
rawY()
Return the gyro's raw Y value.
|
int |
rawZ()
Return the gyro's raw Z value.
|
byte |
read8(ModernRoboticsI2cGyro.Register reg) |
ModernRoboticsI2cGyro.Command |
readCommand() |
short |
readShort(ModernRoboticsI2cGyro.Register reg) |
void |
resetZAxisIntegrator()
Set the integrated Z axis to zero.
|
void |
setHeadingMode(ModernRoboticsI2cGyro.HeadingMode headingMode) |
void |
setI2cAddress(I2cAddr newAddress)
Configures a new I2C address to use
|
protected void |
setOptimalReadWindow() |
void |
setZAxisOffset(short offset) |
void |
setZAxisScalingCoefficient(int zAxisScalingCoefficient) |
java.lang.String |
status()
Status of this sensor, in string form
|
protected int |
truncate(float angle) |
void |
write8(ModernRoboticsI2cGyro.Register reg,
byte value) |
void |
writeCommand(ModernRoboticsI2cGyro.Command command) |
void |
writeShort(ModernRoboticsI2cGyro.Register reg,
short value) |
close, disengage, engage, getConnectionInfo, getDeviceClient, getVersion, initialize, initializeIfNecessary, onModuleStateChange, registerArmingStateCallback, resetDeviceConfigurationForOpModeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, getConnectionInfo, getVersion, resetDeviceConfigurationForOpModepublic static final I2cAddr ADDRESS_I2C_DEFAULT
protected float degreesPerSecondPerDigit
protected ModernRoboticsI2cGyro.HeadingMode headingMode
protected float degreesPerZAxisTick
public ModernRoboticsI2cGyro(I2cDeviceSynch deviceClient)
protected void setOptimalReadWindow()
protected boolean doInitialize()
I2cDeviceSynchDevicedoInitialize in class I2cDeviceSynchDevice<I2cDeviceSynch>public HardwareDevice.Manufacturer getManufacturer()
HardwareDevicegetManufacturer in interface HardwareDevicepublic java.lang.String getDeviceName()
HardwareDevicegetDeviceName in interface HardwareDevicepublic byte read8(ModernRoboticsI2cGyro.Register reg)
public void write8(ModernRoboticsI2cGyro.Register reg, byte value)
public short readShort(ModernRoboticsI2cGyro.Register reg)
public void writeShort(ModernRoboticsI2cGyro.Register reg, short value)
public void writeCommand(ModernRoboticsI2cGyro.Command command)
public ModernRoboticsI2cGyro.Command readCommand()
public java.util.Set<Axis> getAngularVelocityAxes()
GyroscopeGyroscope.getAngularVelocity(AngleUnit).getAngularVelocityAxes in interface GyroscopeGyroscope.getAngularVelocity(AngleUnit)public java.util.Set<Axis> getAngularOrientationAxes()
OrientationSensorgetAngularOrientationAxes in interface OrientationSensorpublic AngularVelocity getAngularVelocity(AngleUnit unit)
GyroscopegetAngularVelocity in interface Gyroscopeunit - the unit in which the rotation rates are to be returned (the time
dimension is always inverse-seconds).Gyroscope.getAngularVelocityAxes()public Orientation getAngularOrientation(AxesReference reference, AxesOrder order, AngleUnit angleUnit)
OrientationSensorgetAngularOrientation in interface OrientationSensorreference - the axes reference in which the result will be expressedorder - the axes order in which the result will be expressedangleUnit - the angle units in which the result will be expressedOrientationpublic void setHeadingMode(ModernRoboticsI2cGyro.HeadingMode headingMode)
public ModernRoboticsI2cGyro.HeadingMode getHeadingMode()
public int rawX()
rawX in interface GyroSensorpublic int rawY()
GyroSensorrawY in interface GyroSensorrawX()public int rawZ()
GyroSensorrawZ in interface GyroSensorrawX()public int getZAxisOffset()
public void setZAxisOffset(short offset)
public int getZAxisScalingCoefficient()
public void setZAxisScalingCoefficient(int zAxisScalingCoefficient)
public int getIntegratedZValue()
public int getHeading()
GyroSensorgetHeading in interface GyroSensorprotected int truncate(float angle)
protected float normalize0359(float degrees)
protected float degreesZFromIntegratedZ(int integratedZ)
public void resetZAxisIntegrator()
GyroSensorresetZAxisIntegrator in interface GyroSensorpublic java.lang.String status()
GyroSensorstatus in interface GyroSensorpublic void calibrate()
GyroSensorcalibrate in interface GyroSensorpublic boolean isCalibrating()
GyroSensorisCalibrating in interface GyroSensorpublic void setI2cAddress(I2cAddr newAddress)
I2cAddrConfigsetI2cAddress in interface I2cAddrConfignewAddress - the new I2C address to usepublic I2cAddr getI2cAddress()
I2cAddressableDevicegetI2cAddress in interface I2cAddressableDevice@Deprecated public double getRotationFraction()
GyroSensorgetRotationFraction in interface GyroSensor@Deprecated public ModernRoboticsI2cGyro.MeasurementMode getMeasurementMode()
isCalibrating()protected void notSupported()