Hello
Has anyone managed to program in a calibration command for the IMU?
We are trying to compile a modified sample code that we found online and we are getting data from the IMU. But when the chip is flat on the table, we get X and Y readings that are slightly above zero and the Z is slightly above 9.8. We think we need to calibrate the IMU to get things back where they belong.
We set up a couple of basic variables using uint and then attempt to use them to call the .getcalibration function. We have named our IMU "ExtIMU" to clarify it from any internal IMU on the drone.
uint8_t system, gyro, accel, mag = 0;
ExtIMU.getcalibration(&system, &gyro, &accel, &mag);
With other IMU's I have used the .getcalibration command but I am being told that "class Adafruit_ICM20948 has no member named getcalibration"
Bob, I'll give this a try tomorrow and get back to you.
Bob,
The adafruit ICM20x library doesn't have the .getcalibration() function. Full documentation and methods are here: https://circuitpython.readthedocs.io/projects/icm20x/en/latest/api.html.
In my testing, the small errors in the accelerometer don't matter much for calculating the roll and pitch of the IMU, especially when using a low pass filter. See simple explanation here: https://theccontinuum.com/2012/09/24/arduino-imu-pitch-roll-from-accelerometer/
Getting reasonable yaw values, however, is problematic without calibrating the magnetometer. See more details here: https://learn.adafruit.com/adafruit-sensorlab-magnetometer-calibration. I haven't been able to figure out how to calibrate the magnetometer -- adafruit's SensorLab doesn't work with the IMU we've provided.
So, we were hoping you'd be able to use the IMU to: 1) detect and display orientation (pitch, roll, and yaw), and 2) do crash detection. Looks like the yaw values may not be possible without some substantial skills (that I don't possess).
Hope that helps!
Eric
We have followed a lot of the links in the previous post but we are getting varied results from the magnetometer which does not bode well for the yaw.
Does anyone have a working code/process for calibrating the magnetometer yet?