-
- All Implemented Interfaces:
-
com.qualcomm.hardware.bosch.BNO055IMU
,com.qualcomm.robotcore.eventloop.opmode.OpModeManagerNotifier.Notifications
,com.qualcomm.robotcore.hardware.Gyroscope
,com.qualcomm.robotcore.hardware.HardwareDevice
,com.qualcomm.robotcore.hardware.I2cAddrConfig
,com.qualcomm.robotcore.hardware.I2cAddressableDevice
,com.qualcomm.robotcore.hardware.IntegratingGyroscope
,com.qualcomm.robotcore.hardware.OrientationSensor
,com.qualcomm.robotcore.hardware.usb.RobotArmingStateNotifier.Callback
public abstract class BNO055IMUImpl extends I2cDeviceSynchDeviceWithParameters<I2cDeviceSynch, BNO055IMU.Parameters> implements BNO055IMU, Gyroscope, IntegratingGyroscope, I2cAddrConfig, OpModeManagerNotifier.Notifications
BNO055IMUImpl provides support for communicating with a BNO055 inertial motion unit. Sensors using this integrated circuit are available from several manufacturers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
BNO055IMUImpl.ImuNotInitializedException
-
Field Summary
Fields Modifier and Type Field Description public final static byte
bCHIP_ID_VALUE
-
Constructor Summary
Constructors Constructor Description BNO055IMUImpl(I2cDeviceSynch deviceClient, boolean deviceClientIsOwned)
This constructor is called internally by the FTC SDK.
-
Method Summary
Modifier and Type Method Description static boolean
imuIsPresent(I2cDeviceSynchSimple deviceClient, boolean retryAfterWaiting)
The deviceClient parameter needs to already have its I2C address set. void
resetDeviceConfigurationForOpMode()
void
onOpModePreInit(OpMode opMode)
void
onOpModePreStart(OpMode opMode)
void
onOpModePostStop(OpMode opMode)
I2cAddr
getI2cAddress()
void
setI2cAddress(I2cAddr newAddress)
boolean
internalInitialize(@NonNull() BNO055IMU.Parameters parameters)
Initialize the device to be running in the indicated operation mode synchronized BNO055IMU.SystemStatus
getSystemStatus()
Returns the current status of the system. synchronized BNO055IMU.SystemError
getSystemError()
If getSystemStatus is 'system error' (1), returns particularsregarding that error.See section 4.3.58 of the BNO055 specification. synchronized BNO055IMU.CalibrationStatus
getCalibrationStatus()
Returns the calibration status of the IMU void
close()
abstract String
getDeviceName()
abstract HardwareDevice.Manufacturer
getManufacturer()
Set<Axis>
getAngularVelocityAxes()
Set<Axis>
getAngularOrientationAxes()
synchronized AngularVelocity
getAngularVelocity(AngleUnit unit)
Orientation
getAngularOrientation(AxesReference reference, AxesOrder order, AngleUnit angleUnit)
Returns the absolute orientation of the sensor as a set three angles with indicated parameters. synchronized boolean
isSystemCalibrated()
Answers as to whether the system is fully calibrated. synchronized boolean
isGyroCalibrated()
Answers as to whether the gyro is fully calibrated. synchronized boolean
isAccelerometerCalibrated()
Answers as to whether the accelerometer is fully calibrated. synchronized boolean
isMagnetometerCalibrated()
Answers as to whether the magnetometer is fully calibrated. BNO055IMU.CalibrationData
readCalibrationData()
Read calibration data from the IMU which later can be restored with writeCalibrationData().This might be persistently stored, and reapplied at a later power-on.For greatest utility, full calibration should be achieved before readingthe calibration data. void
writeCalibrationData(BNO055IMU.CalibrationData data)
Write calibration data previously retrieved. synchronized Temperature
getTemperature()
Returns the current temperature. synchronized MagneticFlux
getMagneticFieldStrength()
Returns the magnetic field strength experienced by the sensor. synchronized Acceleration
getOverallAcceleration()
Returns the overall acceleration experienced by the sensor. synchronized Acceleration
getLinearAcceleration()
Returns the acceleration experienced by the sensor due to the movement of the sensor. synchronized Acceleration
getGravity()
Returns the direction of the force of gravity relative to the sensor. synchronized AngularVelocity
getAngularVelocity()
Returns the rate of change of the absolute orientation of the sensor. synchronized Orientation
getAngularOrientation()
Returns the absolute orientation of the sensor as a set three angles synchronized Quaternion
getQuaternionOrientation()
Returns the absolute orientation of the sensor as a quaternion. Acceleration
getAcceleration()
Returns the last observed acceleration of the sensor. Velocity
getVelocity()
Returns the current velocity of the sensor as calculated by integrating the observedsensor accelerations. Position
getPosition()
Returns the current position of the sensor as calculated by doubly integrating the observedsensor accelerations. void
startAccelerationIntegration(Position initalPosition, Velocity initialVelocity, int msPollInterval)
Start (or re-start) a thread that continuously at intervals polls the current linear accelerationof the sensor and integrates it to provide velocity and position information. void
stopAccelerationIntegration()
Stop the integration thread if it is currently running. synchronized byte
read8(BNO055IMU.Register reg)
Low level: read the byte starting at the indicated register synchronized Array<byte>
read(BNO055IMU.Register reg, int cb)
Low level: read data starting at the indicated register void
write8(BNO055IMU.Register reg, int data)
Low level: write a byte to the indicated register void
write8(BNO055IMU.Register reg, int data, I2cWaitControl waitControl)
void
write(BNO055IMU.Register reg, Array<byte> data)
Low level: write data starting at the indicated register void
write(BNO055IMU.Register reg, Array<byte> data, I2cWaitControl waitControl)
-
Methods inherited from class com.qualcomm.robotcore.hardware.I2cDeviceSynchDeviceWithParameters
getParameters, initialize, resetDeviceConfigurationForOpMode
-
Methods inherited from class com.qualcomm.robotcore.hardware.I2cDeviceSynchDevice
close, getConnectionInfo, getDeviceClient, getVersion, onModuleStateChange
-
Methods inherited from class com.qualcomm.robotcore.hardware.HardwareDevice
getDeviceName, getManufacturer
-
Methods inherited from class com.qualcomm.hardware.bosch.BNO055IMU
getParameters, initialize, read, read8, startAccelerationIntegration, write, write8
-
Methods inherited from class com.qualcomm.robotcore.hardware.Gyroscope
getAngularVelocity, getAngularVelocityAxes
-
Methods inherited from class com.qualcomm.robotcore.hardware.OrientationSensor
getAngularOrientation, getAngularOrientationAxes
-
Methods inherited from class com.qualcomm.robotcore.hardware.I2cAddrConfig
setI2cAddress
-
Methods inherited from class com.qualcomm.robotcore.hardware.I2cAddressableDevice
getI2cAddress
-
Methods inherited from class com.qualcomm.robotcore.eventloop.opmode.OpModeManagerNotifier.Notifications
onOpModePostStop, onOpModePreInit, onOpModePreStart
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
imuIsPresent
static boolean imuIsPresent(I2cDeviceSynchSimple deviceClient, boolean retryAfterWaiting)
The deviceClient parameter needs to already have its I2C address set.
-
resetDeviceConfigurationForOpMode
void resetDeviceConfigurationForOpMode()
-
onOpModePreInit
void onOpModePreInit(OpMode opMode)
-
onOpModePreStart
void onOpModePreStart(OpMode opMode)
-
onOpModePostStop
void onOpModePostStop(OpMode opMode)
-
getI2cAddress
I2cAddr getI2cAddress()
-
setI2cAddress
void setI2cAddress(I2cAddr newAddress)
-
internalInitialize
boolean internalInitialize(@NonNull() BNO055IMU.Parameters parameters)
Initialize the device to be running in the indicated operation mode
-
getSystemStatus
synchronized BNO055IMU.SystemStatus getSystemStatus()
Returns the current status of the system.
-
getSystemError
synchronized BNO055IMU.SystemError getSystemError()
If getSystemStatus is 'system error' (1), returns particularsregarding that error.See section 4.3.58 of the BNO055 specification.
-
getCalibrationStatus
synchronized BNO055IMU.CalibrationStatus getCalibrationStatus()
Returns the calibration status of the IMU
-
close
void close()
-
getDeviceName
abstract String getDeviceName()
-
getManufacturer
abstract HardwareDevice.Manufacturer getManufacturer()
-
getAngularVelocityAxes
Set<Axis> getAngularVelocityAxes()
-
getAngularOrientationAxes
Set<Axis> getAngularOrientationAxes()
-
getAngularVelocity
synchronized AngularVelocity getAngularVelocity(AngleUnit unit)
-
getAngularOrientation
Orientation getAngularOrientation(AxesReference reference, AxesOrder order, AngleUnit angleUnit)
Returns the absolute orientation of the sensor as a set three angles with indicated parameters.
- Parameters:
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 expressed
-
isSystemCalibrated
synchronized boolean isSystemCalibrated()
Answers as to whether the system is fully calibrated. The system is fullycalibrated if the gyro, accelerometer, and magnetometer are fully calibrated.
-
isGyroCalibrated
synchronized boolean isGyroCalibrated()
Answers as to whether the gyro is fully calibrated.
-
isAccelerometerCalibrated
synchronized boolean isAccelerometerCalibrated()
Answers as to whether the accelerometer is fully calibrated.
-
isMagnetometerCalibrated
synchronized boolean isMagnetometerCalibrated()
Answers as to whether the magnetometer is fully calibrated.
-
readCalibrationData
BNO055IMU.CalibrationData readCalibrationData()
Read calibration data from the IMU which later can be restored with writeCalibrationData().This might be persistently stored, and reapplied at a later power-on.For greatest utility, full calibration should be achieved before readingthe calibration data.
-
writeCalibrationData
void writeCalibrationData(BNO055IMU.CalibrationData data)
Write calibration data previously retrieved.
- Parameters:
data
- the calibration data to write
-
getTemperature
synchronized Temperature getTemperature()
Returns the current temperature.
-
getMagneticFieldStrength
synchronized MagneticFlux getMagneticFieldStrength()
Returns the magnetic field strength experienced by the sensor. See Section 3.6.5.2 ofthe BNO055 specification.
-
getOverallAcceleration
synchronized Acceleration getOverallAcceleration()
Returns the overall acceleration experienced by the sensor. This is composed ofa component due to the movement of the sensor and a component due to the force of gravity.
-
getLinearAcceleration
synchronized Acceleration getLinearAcceleration()
Returns the acceleration experienced by the sensor due to the movement of the sensor.
-
getGravity
synchronized Acceleration getGravity()
Returns the direction of the force of gravity relative to the sensor.
-
getAngularVelocity
synchronized AngularVelocity getAngularVelocity()
Returns the rate of change of the absolute orientation of the sensor.
-
getAngularOrientation
synchronized Orientation getAngularOrientation()
Returns the absolute orientation of the sensor as a set three angles
-
getQuaternionOrientation
synchronized Quaternion getQuaternionOrientation()
Returns the absolute orientation of the sensor as a quaternion.
-
getAcceleration
Acceleration getAcceleration()
Returns the last observed acceleration of the sensor. Note that this does not communicatewith the sensor, but rather returns the most recent value reported to the accelerationintegration algorithm.
-
getVelocity
Velocity getVelocity()
Returns the current velocity of the sensor as calculated by integrating the observedsensor accelerations.
-
getPosition
Position getPosition()
Returns the current position of the sensor as calculated by doubly integrating the observedsensor accelerations.
-
startAccelerationIntegration
void startAccelerationIntegration(Position initalPosition, Velocity initialVelocity, int msPollInterval)
Start (or re-start) a thread that continuously at intervals polls the current linear accelerationof the sensor and integrates it to provide velocity and position information.
- Parameters:
initialVelocity
- If non-null, the current sensor velocity is set to this value.msPollInterval
- the interval to use, in milliseconds, between successive calls to getLinearAcceleration
-
stopAccelerationIntegration
void stopAccelerationIntegration()
Stop the integration thread if it is currently running.
-
read8
synchronized byte read8(BNO055IMU.Register reg)
Low level: read the byte starting at the indicated register
-
read
synchronized Array<byte> read(BNO055IMU.Register reg, int cb)
Low level: read data starting at the indicated register
- Parameters:
cb
- the number of bytes to read
-
write8
void write8(BNO055IMU.Register reg, int data)
Low level: write a byte to the indicated register
-
write8
void write8(BNO055IMU.Register reg, int data, I2cWaitControl waitControl)
-
write
void write(BNO055IMU.Register reg, Array<byte> data)
Low level: write data starting at the indicated register
- Parameters:
data
- the data to write
-
write
void write(BNO055IMU.Register reg, Array<byte> data, I2cWaitControl waitControl)
-
-
-
-