public abstract class BNO055IMUImpl extends I2cDeviceSynchDeviceWithParameters<I2cDeviceSynch,BNO055IMU.Parameters> implements BNO055IMU, Gyroscope, IntegratingGyroscope, I2cAddrConfig
BNO055IMUImpl
provides support for communicating with a BNO055 inertial motion
unit. Sensors using this integrated circuit are available from several manufacturers.Modifier and Type | Class and Description |
---|---|
protected static class |
BNO055IMUImpl.VectorData |
BNO055IMU.AccelBandwidth, BNO055IMU.AccelerationIntegrator, BNO055IMU.AccelPowerMode, BNO055IMU.AccelRange, BNO055IMU.AccelUnit, BNO055IMU.AngleUnit, BNO055IMU.CalibrationData, BNO055IMU.CalibrationStatus, BNO055IMU.GyroBandwidth, BNO055IMU.GyroPowerMode, BNO055IMU.GyroRange, BNO055IMU.MagOpMode, BNO055IMU.MagPowerMode, BNO055IMU.MagRate, BNO055IMU.Parameters, BNO055IMU.PitchMode, BNO055IMU.Register, BNO055IMU.SensorMode, BNO055IMU.SystemError, BNO055IMU.SystemStatus, BNO055IMU.TempUnit
HardwareDevice.Manufacturer
Modifier and Type | Field and Description |
---|---|
protected BNO055IMU.AccelerationIntegrator |
accelerationAlgorithm |
protected java.util.concurrent.ExecutorService |
accelerationMananger |
protected BNO055IMU.SensorMode |
currentMode |
protected java.lang.Object |
dataLock |
protected float |
delayScale |
protected static I2cDeviceSynch.ReadWindow |
lowerWindow
One of two primary register windows we use for reading from the BNO055.
|
protected static int |
msAwaitChipId |
protected static int |
msAwaitSelfTest |
protected static int |
msExtra |
protected static I2cDeviceSynch.ReadMode |
readMode |
protected java.lang.Object |
startStopLock |
protected static I2cDeviceSynch.ReadWindow |
upperWindow
A second of two primary register windows we use for reading from the BNO055.
|
parameters
deviceClient, deviceClientIsOwned, isInitialized
I2CADDR_ALTERNATE, I2CADDR_DEFAULT, I2CADDR_UNSPECIFIED
Constructor and Description |
---|
BNO055IMUImpl(I2cDeviceSynch deviceClient)
This constructor is used by
UserConfigurationType#createInstance(I2cController, int) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this device
|
protected void |
delay(int ms)
delay() implements delays which are known to be necessary according to the BNO055 specification
|
protected void |
delayExtra(int ms) |
protected void |
delayLore(int ms)
delayLore() implements a delay that only known by lore and mythology to be necessary.
|
protected void |
delayLoreExtra(int ms) |
protected static BNO055IMU.Parameters |
disabledParameters() |
protected void |
ensureReadWindow(I2cDeviceSynch.ReadWindow needed) |
protected <T> T |
enterConfigModeFor(Func<T> lambda) |
protected void |
enterConfigModeFor(java.lang.Runnable action) |
Acceleration |
getAcceleration()
Returns the last observed acceleration of the sensor.
|
protected float |
getAccelerationScale()
Return the number by which we need to divide a raw acceleration as read from the device in order
to convert it to our current acceleration units.
|
Orientation |
getAngularOrientation()
Returns the absolute orientation of the sensor as a set three angles
|
Orientation |
getAngularOrientation(AxesReference reference,
AxesOrder order,
AngleUnit angleUnit)
Returns the absolute orientation of the sensor as a set three angles with indicated parameters.
|
java.util.Set<Axis> |
getAngularOrientationAxes()
Returns the axes on which the sensor measures angular orientation.
|
protected float |
getAngularScale()
Return the number by which we need to divide a raw angle as read from the device in order
to convert it to our current angular units.
|
AngularVelocity |
getAngularVelocity()
Returns the rate of change of the absolute orientation of the sensor.
|
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.
|
BNO055IMU.CalibrationStatus |
getCalibrationStatus()
Returns the calibration status of the IMU
|
abstract java.lang.String |
getDeviceName()
Returns a string suitable for display to the user as to the type of device.
|
protected float |
getFluxScale()
Return the number by which we need to divide a raw acceleration as read from the device in order
to convert it to our current angular units.
|
Acceleration |
getGravity()
Returns the direction of the force of gravity relative to the sensor.
|
I2cAddr |
getI2cAddress()
Returns the I2C address currently in use to communicate with an I2C hardware device
|
Acceleration |
getLinearAcceleration()
Returns the acceleration experienced by the sensor due to the movement of the sensor.
|
protected java.lang.String |
getLoggingTag() |
MagneticFlux |
getMagneticFieldStrength()
Returns the magnetic field strength experienced by the sensor.
|
abstract HardwareDevice.Manufacturer |
getManufacturer()
Returns an indication of the manufacturer of this device.
|
protected float |
getMetersAccelerationScale() |
Acceleration |
getOverallAcceleration()
Returns the overall acceleration experienced by the sensor.
|
Position |
getPosition()
Returns the current position of the sensor as calculated by doubly integrating the observed
sensor accelerations.
|
Quaternion |
getQuaternionOrientation()
Returns the absolute orientation of the sensor as a quaternion.
|
BNO055IMU.SystemError |
getSystemError()
If
BNO055IMU.getSystemStatus() is 'system error' (1), returns particulars
regarding that error. |
BNO055IMU.SystemStatus |
getSystemStatus()
Returns the current status of the system.
|
Temperature |
getTemperature()
Returns the current temperature.
|
protected BNO055IMUImpl.VectorData |
getVector(com.qualcomm.hardware.bosch.BNO055IMUImpl.VECTOR vector,
float scale) |
Velocity |
getVelocity()
Returns the current velocity of the sensor as calculated by integrating the observed
sensor accelerations.
|
boolean |
internalInitialize(BNO055IMU.Parameters parameters)
Initialize the device to be running in the indicated operation mode
|
protected boolean |
internalInitializeOnce(BNO055IMU.SystemStatus expectedStatus)
Do one attempt at initializing the device to be running in the indicated operation mode
|
boolean |
isAccelerometerCalibrated()
Answers as to whether the accelerometer is fully calibrated.
|
boolean |
isGyroCalibrated()
Answers as to whether the gyro is fully calibrated.
|
boolean |
isMagnetometerCalibrated()
Answers as to whether the magnetometer is fully calibrated.
|
boolean |
isSystemCalibrated()
Answers as to whether the system is fully calibrated.
|
protected void |
log_d(java.lang.String format,
java.lang.Object... args) |
protected void |
log_e(java.lang.String format,
java.lang.Object... args) |
protected void |
log_v(java.lang.String format,
java.lang.Object... args) |
protected void |
log_w(java.lang.String format,
java.lang.Object... args) |
protected static I2cDeviceSynch.ReadWindow |
newWindow(BNO055IMU.Register regFirst,
BNO055IMU.Register regMax) |
void |
onOpModePostStop(OpMode opMode) |
void |
onOpModePreInit(OpMode opMode) |
void |
onOpModePreStart(OpMode opMode) |
byte[] |
read(BNO055IMU.Register reg,
int cb)
Low level: read data starting at the indicated register
|
byte |
read8(BNO055IMU.Register reg)
Low level: read the byte starting at the indicated register
|
BNO055IMU.CalibrationData |
readCalibrationData()
Read calibration data from the IMU which later can be restored with writeCalibrationData().
|
protected short |
readShort(BNO055IMU.Register reg) |
void |
resetDeviceConfigurationForOpMode()
Resets the device's configuration to that which is expected at the beginning of an OpMode.
|
void |
setI2cAddress(I2cAddr newAddress)
Configures a new I2C address to use
|
protected void |
setSensorMode(BNO055IMU.SensorMode mode) |
void |
startAccelerationIntegration(Position initalPosition,
Velocity initialVelocity,
int msPollInterval)
Start (or re-start) a thread that continuously at intervals polls the current linear acceleration
of the sensor and integrates it to provide velocity and position information.
|
void |
stopAccelerationIntegration()
Stop the integration thread if it is currently running.
|
protected void |
waitForWriteCompletions() |
void |
write(BNO055IMU.Register reg,
byte[] data)
Low level: write data starting at the indicated register
|
void |
write8(BNO055IMU.Register reg,
int data)
Low level: write a byte to the indicated register
|
void |
writeCalibrationData(BNO055IMU.CalibrationData data)
Write calibration data previously retrieved.
|
protected void |
writeShort(BNO055IMU.Register reg,
short value) |
doInitialize, getParameters, initialize
disengage, engage, getConnectionInfo, getDeviceClient, getVersion, initialize, initializeIfNecessary, onModuleStateChange, registerArmingStateCallback
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParameters, initialize
protected BNO055IMU.SensorMode currentMode
protected final java.lang.Object dataLock
protected BNO055IMU.AccelerationIntegrator accelerationAlgorithm
protected final java.lang.Object startStopLock
protected java.util.concurrent.ExecutorService accelerationMananger
protected float delayScale
protected static final int msAwaitChipId
protected static final int msAwaitSelfTest
protected static final I2cDeviceSynch.ReadMode readMode
protected static final I2cDeviceSynch.ReadWindow lowerWindow
protected static final I2cDeviceSynch.ReadWindow upperWindow
lowerWindow
protected static final int msExtra
public BNO055IMUImpl(I2cDeviceSynch deviceClient)
UserConfigurationType#createInstance(I2cController, int)
UserConfigurationType#createInstance(I2cController, int)
,
I2cDeviceType
protected static I2cDeviceSynch.ReadWindow newWindow(BNO055IMU.Register regFirst, BNO055IMU.Register regMax)
protected static BNO055IMU.Parameters disabledParameters()
public void resetDeviceConfigurationForOpMode()
HardwareDevice
resetDeviceConfigurationForOpMode
in interface HardwareDevice
resetDeviceConfigurationForOpMode
in class I2cDeviceSynchDevice<I2cDeviceSynch>
public void onOpModePreInit(OpMode opMode)
public void onOpModePreStart(OpMode opMode)
public void onOpModePostStop(OpMode opMode)
public I2cAddr getI2cAddress()
I2cAddressableDevice
getI2cAddress
in interface I2cAddressableDevice
public void setI2cAddress(I2cAddr newAddress)
I2cAddrConfig
setI2cAddress
in interface I2cAddrConfig
newAddress
- the new I2C address to usepublic boolean internalInitialize(BNO055IMU.Parameters parameters)
internalInitialize
in class I2cDeviceSynchDeviceWithParameters<I2cDeviceSynch,BNO055IMU.Parameters>
parameters
- the parameter block with which to initializeprotected boolean internalInitializeOnce(BNO055IMU.SystemStatus expectedStatus)
protected void setSensorMode(BNO055IMU.SensorMode mode)
public BNO055IMU.SystemStatus getSystemStatus()
BNO055IMU
getSystemStatus
in interface BNO055IMU
Result Meaning
0 idle
1 system error
2 initializing peripherals
3 system initialization
4 executing self-test
5 sensor fusion algorithm running
6 system running without fusion algorithms
public BNO055IMU.SystemError getSystemError()
BNO055IMU
BNO055IMU.getSystemStatus()
is 'system error' (1), returns particulars
regarding that error.
See section 4.3.58 of the BNO055 specification.getSystemError
in interface BNO055IMU
Result Meaning
0 no error
1 peripheral initialization error
2 system initialization error
3 self test result failed
4 register map value out of range
5 register map address out of range
6 register map write error
7 BNO low power mode not available for selected operation mode
8 accelerometer power mode not available
9 fusion algorithm configuration error
A sensor configuration error
public BNO055IMU.CalibrationStatus getCalibrationStatus()
BNO055IMU
getCalibrationStatus
in interface BNO055IMU
public void close()
HardwareDevice
close
in interface BNO055IMU
close
in interface HardwareDevice
close
in class I2cDeviceSynchDevice<I2cDeviceSynch>
public abstract java.lang.String getDeviceName()
HardwareDevice
getDeviceName
in interface HardwareDevice
public abstract HardwareDevice.Manufacturer getManufacturer()
HardwareDevice
getManufacturer
in interface HardwareDevice
public java.util.Set<Axis> getAngularVelocityAxes()
Gyroscope
Gyroscope.getAngularVelocity(AngleUnit)
.getAngularVelocityAxes
in interface Gyroscope
Gyroscope.getAngularVelocity(AngleUnit)
public java.util.Set<Axis> getAngularOrientationAxes()
OrientationSensor
getAngularOrientationAxes
in interface OrientationSensor
public AngularVelocity getAngularVelocity(AngleUnit unit)
Gyroscope
getAngularVelocity
in interface Gyroscope
unit
- 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)
BNO055IMU
getAngularOrientation
in interface BNO055IMU
getAngularOrientation
in interface OrientationSensor
reference
- 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 expressedOrientation
,
BNO055IMU.getAngularOrientation()
public boolean isSystemCalibrated()
BNO055IMU
isSystemCalibrated
in interface BNO055IMU
public boolean isGyroCalibrated()
BNO055IMU
isGyroCalibrated
in interface BNO055IMU
public boolean isAccelerometerCalibrated()
BNO055IMU
isAccelerometerCalibrated
in interface BNO055IMU
public boolean isMagnetometerCalibrated()
BNO055IMU
isMagnetometerCalibrated
in interface BNO055IMU
public BNO055IMU.CalibrationData readCalibrationData()
BNO055IMU
readCalibrationData
in interface BNO055IMU
BNO055IMU.writeCalibrationData(CalibrationData)
public void writeCalibrationData(BNO055IMU.CalibrationData data)
BNO055IMU
writeCalibrationData
in interface BNO055IMU
data
- the calibration data to writeBNO055IMU.readCalibrationData()
public Temperature getTemperature()
BNO055IMU
getTemperature
in interface BNO055IMU
public MagneticFlux getMagneticFieldStrength()
BNO055IMU
getMagneticFieldStrength
in interface BNO055IMU
public Acceleration getOverallAcceleration()
BNO055IMU
getOverallAcceleration
in interface BNO055IMU
BNO055IMU.getLinearAcceleration()
,
BNO055IMU.getGravity()
public Acceleration getLinearAcceleration()
BNO055IMU
getLinearAcceleration
in interface BNO055IMU
BNO055IMU.getOverallAcceleration()
,
BNO055IMU.getGravity()
public Acceleration getGravity()
BNO055IMU
getGravity
in interface BNO055IMU
BNO055IMU.getOverallAcceleration()
,
BNO055IMU.getLinearAcceleration()
public AngularVelocity getAngularVelocity()
BNO055IMU
getAngularVelocity
in interface BNO055IMU
BNO055IMU.getAngularOrientation()
public Orientation getAngularOrientation()
BNO055IMU
getAngularOrientation
in interface BNO055IMU
BNO055IMU.getQuaternionOrientation()
,
Orientation
,
BNO055IMU.getAngularOrientation(AxesReference, AxesOrder, org.firstinspires.ftc.robotcore.external.navigation.AngleUnit)
public Quaternion getQuaternionOrientation()
BNO055IMU
getQuaternionOrientation
in interface BNO055IMU
BNO055IMU.getAngularOrientation()
protected float getAngularScale()
protected float getAccelerationScale()
protected float getMetersAccelerationScale()
protected float getFluxScale()
protected BNO055IMUImpl.VectorData getVector(com.qualcomm.hardware.bosch.BNO055IMUImpl.VECTOR vector, float scale)
public Acceleration getAcceleration()
BNO055IMU
getAcceleration
in interface BNO055IMU
BNO055IMU.getLinearAcceleration()
,
BNO055IMU.Parameters.accelerationIntegrationAlgorithm
,
BNO055IMU.startAccelerationIntegration(Position, Velocity, int)
public Velocity getVelocity()
BNO055IMU
getVelocity
in interface BNO055IMU
BNO055IMU.Parameters.accelerationIntegrationAlgorithm
,
BNO055IMU.startAccelerationIntegration(Position, Velocity, int)
public Position getPosition()
BNO055IMU
getPosition
in interface BNO055IMU
BNO055IMU.Parameters.accelerationIntegrationAlgorithm
,
BNO055IMU.startAccelerationIntegration(Position, Velocity, int)
public void startAccelerationIntegration(Position initalPosition, Velocity initialVelocity, int msPollInterval)
BNO055IMU
startAccelerationIntegration
in interface BNO055IMU
initalPosition
- If non-null, the current sensor position is set to this value. If
null, the current sensor position is unchanged.initialVelocity
- If non-null, the current sensor velocity is set to this value. If
null, the current sensor velocity is unchanged.msPollInterval
- the interval to use, in milliseconds, between successive calls to BNO055IMU.getLinearAcceleration()
BNO055IMU.stopAccelerationIntegration()
,
BNO055IMU.AccelerationIntegrator
public void stopAccelerationIntegration()
BNO055IMU
stopAccelerationIntegration
in interface BNO055IMU
BNO055IMU.startAccelerationIntegration(Position, Velocity, int)
public byte read8(BNO055IMU.Register reg)
BNO055IMU
public byte[] read(BNO055IMU.Register reg, int cb)
BNO055IMU
protected short readShort(BNO055IMU.Register reg)
public void write8(BNO055IMU.Register reg, int data)
BNO055IMU
public void write(BNO055IMU.Register reg, byte[] data)
BNO055IMU
protected void writeShort(BNO055IMU.Register reg, short value)
protected void waitForWriteCompletions()
protected java.lang.String getLoggingTag()
protected void log_v(java.lang.String format, java.lang.Object... args)
protected void log_d(java.lang.String format, java.lang.Object... args)
protected void log_w(java.lang.String format, java.lang.Object... args)
protected void log_e(java.lang.String format, java.lang.Object... args)
protected void ensureReadWindow(I2cDeviceSynch.ReadWindow needed)
protected void delayExtra(int ms)
protected void delayLoreExtra(int ms)
protected void delayLore(int ms)
delay(int)
protected void delay(int ms)
delayLore(int)
protected void enterConfigModeFor(java.lang.Runnable action)
protected <T> T enterConfigModeFor(Func<T> lambda)