Thanks for pointing out that we should be using IMU mode instead of NDOF mode when using this sensor as a measurement of rotation. I had misinterpreted the data sheet and thought that I needed one of the absolute modes in order to have the sensor accumulate the rotation. I had not realized that this sensor's absolute modes (like NDOF) were referring to tracking the rotation with respect to the earth's magnetic field.
We are using the Adafruit version of the breakout board for the BNO055 sensor (
https://www.adafruit.com/products/2472).
If you are interested, we have added a GyroAdapter class to our library that can be used as a WPIlib Gyro implementation. I have added some methods to your BNO055 code to allow for the creation of these gyro instances.
Something along the lines of:
Code:
// New getInstance() that puts sensor in IMU/Euler mode
BNO055 sensor = BNO055.getInstance(I2C.Port.kOnboard);
private Gyro gyrox;
private double turn = 90;
public void initialize() {
// Create a Gyro where current orientation is treated as 0.0.
gyrox = sensor.createGyroX();
}
public boolean isFinished() {
// Done once we are within 3 degrees of desired turn
return (Math.abs(gyrox.getAngle() - turn) < 3.0);
}
If you have any interest in our modifications, the source can be found at:
https://github.com/frc868/frc868-lib...hounds/sensors
A word of warning about the soure. We are still in the process of testing and have only been working with the x-axis rotation on our robot.
Thanks again for you help.