Difference between revisions of "ImuCalibration"

From PaparazziUAV
Jump to navigation Jump to search
 
Line 1: Line 1:
== Theory ==


Accelerometers and Magnetometers calibration is critical for AHRS performances and can be performed using no special hardware. For the magnetometer, it is even very important that the calibration be performed in the fully assembled vehicle, with all systems powered. This is the so-called hard-iron calibration and will allow us to compensate for any constant parasitic magnetic field generated by the vehicle.
Accelerometers and Magnetometers calibration is critical for AHRS performances and can be performed using no special hardware. For the magnetometer, it is even very important that the calibration be performed in the fully assembled vehicle, with all systems powered. This is the so-called hard-iron calibration and will allow us to compensate for any constant parasitic magnetic field generated by the vehicle.
Line 26: Line 27:
We can then record an important number of measurements in different orientations and find the set of scale factor and neutral giving the norm closest to 9.81
We can then record an important number of measurements in different orientations and find the set of scale factor and neutral giving the norm closest to 9.81


Booz comes with a ( very unfriendly ) scilab script to perform this operation ( sw/tools/calibration/calib_accel_mag.sce ). Here is the way to use it
== calibration script ==
Booz comes with a python script to perform this operation ( sw/tools/calibration/calibrate.py ). Here is the way to use it


Switch to the "raw sensors" telemetry mode and launch "server" to record a log.  
Switch to the "raw sensors" telemetry mode and launch "server" to record a log.  
Line 32: Line 34:
Move the quad in different orientations ( upright, inverted, on nose, on tail, on right side, on left side ) . You can also take some measurememts banking 45 degres.  
Move the quad in different orientations ( upright, inverted, on nose, on tail, on right side, on left side ) . You can also take some measurememts banking 45 degres.  


Try to get an homogeneous distribution of your measurements. I find it better to let the quad rest while measuring. You can then run the scilab script to get your calibration coefficients. It first makes an initial guess using min and max, ie for each axis
Try to get an homogeneous distribution of your measurements. I find it better to let the quad rest while measuring.
 
 
You can then run the python script to get your calibration coefficients.
e.g. for accelerometer calibration: ''sw/tools/calibration/calibrate.py -i <your_ac_id> -s ACCEL <path_to_data_file>''
 
It first makes an initial guess using min and max, ie for each axis


neutral = 0.5 * (max + min)
neutral = 0.5 * (max + min)
Line 38: Line 46:
sensitivity = 0.5*(max-min)
sensitivity = 0.5*(max-min)


It then uses scilab's "datafit" algorithm to optimise the initial guess
It then uses a datafit algorithm to optimise the initial guess
 


Screenshot of scilab version.
[[Image:calibAccel.png|240px]]
[[Image:calibAccel.png|240px]]




Note for magnetometer:
Note for magnetometer: Because the magnetic field changes depending where on the globe you are, you will have to recalibrate your mag to fly somewhere else.
When you move the quad to different positions for logging make sure you align it along the direction of the magnetic field which will result in the maximum values for each axis ( or you can look up the inclination and declination of the magnetic field where you live ).

Revision as of 12:39, 20 June 2010

Theory

Accelerometers and Magnetometers calibration is critical for AHRS performances and can be performed using no special hardware. For the magnetometer, it is even very important that the calibration be performed in the fully assembled vehicle, with all systems powered. This is the so-called hard-iron calibration and will allow us to compensate for any constant parasitic magnetic field generated by the vehicle. The calibration process consist in finding a set of neutrals and scale factors for each sensor, such as



The principle of the calibration is the following : An accelerometer, on a vehicle at rest measures a constant vector ( the opposite of gravity ) in the earth frame, expressed in the vehicle frame.


DCM is a rotation matrix that converts between earth frame and body frame. It will change when we change the orientation of the vehicle. Nevertheless, a rotation conserves the norm of a vector. We can thus obtain the following scalar equation that doesn't depend on the vehicle orientation :


We can then record an important number of measurements in different orientations and find the set of scale factor and neutral giving the norm closest to 9.81

calibration script

Booz comes with a python script to perform this operation ( sw/tools/calibration/calibrate.py ). Here is the way to use it

Switch to the "raw sensors" telemetry mode and launch "server" to record a log.

Move the quad in different orientations ( upright, inverted, on nose, on tail, on right side, on left side ) . You can also take some measurememts banking 45 degres.

Try to get an homogeneous distribution of your measurements. I find it better to let the quad rest while measuring.


You can then run the python script to get your calibration coefficients. e.g. for accelerometer calibration: sw/tools/calibration/calibrate.py -i <your_ac_id> -s ACCEL <path_to_data_file>

It first makes an initial guess using min and max, ie for each axis

neutral = 0.5 * (max + min)

sensitivity = 0.5*(max-min)

It then uses a datafit algorithm to optimise the initial guess


Screenshot of scilab version. CalibAccel.png


Note for magnetometer: Because the magnetic field changes depending where on the globe you are, you will have to recalibrate your mag to fly somewhere else. When you move the quad to different positions for logging make sure you align it along the direction of the magnetic field which will result in the maximum values for each axis ( or you can look up the inclination and declination of the magnetic field where you live ).