IMU used for this project is the MiniIMU-v2 from Pololu, it incorporates several chips that offers 9 degrees of freedom, allowing a complete attitude estimation.
- magnetometers, LSM303, 30Hz Output Data Rate, 1.3gauss scale
- accelerometers, LSM303, 50Hz Output Data Rate, 8g scale
- gyrometers, L3G, 190Hz Output Data Rate, 25Hz cutoff frequency, 2000°/s scale
In order to passively filter noise from mechanical structure especially from motors, the IMU should be soft mounted. It is also possible to use integrated filters provided by the chip, all information regarding available filtering frequency and settings are available in the datasheets.
The algorithm used on the OpenCR firmware is the Madgwick complementary filter. This filter produces good results regarding advanced sensor fusion algorithms (like Kalman filters), and is able to produce complete orientation (yaw, pitch and roll), when using magnetometer (it is not the case on the current OpenCR firmware).
I also use this algorithm for this projects with some improvements:
- include magnetometer measurements
- allow varying time processing
- compute on-line gyrometers biases
- sensors calibration
An automatic bias computing is performed at firmware startup, no immobility check are done doing this process, so robot should absolutely be kept static during this period!
Biases evolve in regard of temperature and mechanical stress on the board, although their computing during robot operation is not mandatory.
Madgwick filter uses accelerometer to compute gyroscopes biases. In details, each time acceleration norm equals to gravity (the robot's speed regarding terrestrial reference frame is constant), so if accelerometer have biases this condition never appends and gyroscope estimated rates diverge from real rates.
The selected method is the 6-point tumble sensor calibration, which use a quite simple sensor model, with scale factor, cross-coupling and offsets. All details can be found on this document from STMicroelectronics.
This calibration must be done after fixing the IMU on its support, because fixing it causes mechanical stress on the PCB which must be calibrated. Its not mandatory to realize systematically this calibration at startup, calibration data could be stored in memory.
The selected method consists in measuring scale factors and offsets which correspond to hard iron distortions. More details and code are available at this really well made github page from kriswiner.
This calibration must be done after fixing the IMU on its support and after inserting it inside the robot frame because all magnetic components such as metallic frame or other electronics components could modify the sensor behavior (hard iron). As for magnetometers, this calibration could be done not systematically.
Development and results
Magnetometer calibration could be easily implemented as explained in kriswiner's document.
The rotation process requires to rotate IMU around its three axis, for now result is given through the arduino console and needs further development to be integrated with ROS (it might already exist package to calibrate IMU that could be used).
After realizing several calibrations on the same magneto, converging results tend to indicated that process is OK.
Accelerometer calibration using 6 points calibrations method doesn't offer such good results.
First the method requires least square regression to obtain calibration matrix coefficients, altough this problem may have been already tackle with embedded software constrains, it still represent significant development effort.
Second, this algo relies on the strong assumption that each measured point correspond to an axis oriented strictly colinear to gravity (ie equal to -g or g). Altgough a speficic cubic part has been designed, the mechanical tolerance can't guarantee that assumption.