Hi Brian
thanks for the new libraries and all the improvements you made this year.
Could you please spend a few words about the calibration process and what your routines expect me to do ? (CalibrateMPU9250)
Sure, I keep meaning to make a video of it, but haven't gotten around yet with the holidays.
First, the gyros are calibrated during the
begin function. All that's needed for a good gyro calibration is that the IMU is stationary. If you would like to redo the calibration at any time, simply call
calibrateGyro. Due to the nature of gyro errors and the way they are currently modeled (simply as a bias), the gyro should be calibrated every time the IMU is used, which is why it's included in the
begin function.
The accelerometers only need to be calibrated once. The error model I'm currently using for the accelerometers is a bias and a scale factor. To calibrate them, call the
calibrateAccel function 6 times, once for each orientation of the IMU (+X, -X, +Y, -Y, +Z, -Z) facing up. This is because we're using the gravity vector to calibrate the accelerometers. The IMU should be stationary when
calibrateAccel is called. You can find an example here:
https://github.com/bolderflight/uNa...MPU9250/CalibrateMPU9250/CalibrateMPU9250.ino
You'll notice I'm using the terminal to tell me when to change the IMU orientation and have a delay before calling
calibrateAccel so I have time to orient and get the IMU stationary before the calibration starts. Once you're done with the calibration, you'll want to get the calibration biases and scale factors with the
get functions, store them in EEPROM, and then use the
set functions to use them in the future.
Finally, the magnetometers only need to be calibrated when their magnetic or electrical environment changes. The error model I'm currently using is a bias and a scale factor. To calibrate them, call the
calibrateMag function and slowly move the IMU in a figure 8. This is a good gif of the motion:
https://lh3.googleusercontent.com/e...zStQhhbs1FImcgOEmUYoeijg-tS4xNh6Kmd234n4=w350
You can also slowly flip IMU in each axis in each direction. We're using the Earth's magnetic field to calibrate the magnetometer and trying to show all 6 magnetometer axis the maximum and minimum magnetic field. The
calibrateMag function returns when it gets enough data for a good calibration; although, it relies on you persistently exciting the IMU to try to show it new information. Once you're done with the calibration, you'll want to get the calibration biases and scale factors with the
get functions, store them in EEPROM, and then use the
set functions to use them in the future.