I am using the BNO055 IMU and the Adafruit Library. I want to store the calibration data and load them after the microcontroller is powered off and repowered on. The Adafruit Library provides an example for storing and restoring but, in actual facts, it does not work. It is always required to recalibrate the magnetometers, but even doing so, the library reperform the whole calibration including the accelerometers.
I would like to simply restore all the calibration data (including the magnetometers) so that no calibration needs to be performed when the IMU starts.
I have read a massive amount of posts on the argument, but I really could not figure out how to reliably load all the calibration data at boot and avoid recalibrating them.
Is there anyone who succeeded and can please share the code?
-
Possible duplicate of After restoring the BNO055 offsets to the sensor the calibration values are all 0Juraj– Juraj ♦2019年12月04日 10:14:29 +00:00Commented Dec 4, 2019 at 10:14
-
Actually no, it is not a duplicate at all. Indeed I am using a Teensy and Arduino. Also, that post does not show code.L_T– L_T2019年12月04日 10:32:47 +00:00Commented Dec 4, 2019 at 10:32
-
read the answer in the duplicate, not the question. there is no way to avoid automatic calibration. the stored calibration is only used while the automatic calibration finishes. don't waste your time on it.Juraj– Juraj ♦2019年12月04日 10:39:25 +00:00Commented Dec 4, 2019 at 10:39
-
Thanks. Then what I am supposed to do? The last comment says "I would ignore the calibration. The sensor handles it. After power-up make same movements and the sensor calibrates itself. " So should I avoid any calibration in the end? And should I avoid storing the calibration in the EEPROM at all?L_T– L_T2019年12月04日 13:08:39 +00:00Commented Dec 4, 2019 at 13:08
-
1github.com/adafruit/Adafruit_BNO055/tree/master/examples/…Juraj– Juraj ♦2019年12月04日 18:54:38 +00:00Commented Dec 4, 2019 at 18:54
1 Answer 1
I found the solution. It is enough to add a function that when reperfoming the calibration of the magnetometer, checks ONLY if the magnetometer is calibrated (while the calibration for the accelerometer and gyroscope is reloaded from the EEPROM).
void performMagCal(void) {
uint8_t system, gyro, accel, mag;
system = gyro = accel = mag = 0;
while (mag != 3) {
bno.getCalibration(&system, &gyro, &accel, &mag);
displayCalStatus();
Serial.println("");
}
Serial.println("\nMagnetometer calibrated!");
}