This thesis performed experimental evaluation of two attitude estimation algorithms based on use of an IMU used in vehicle navigation. The results included the design and implementation of a test bed for such a purpose and a comparison of two methods of data sensor fusion. Also a three axis magnetometer calibration method is presented that is suitable for off-line application.
Based on the experiments, it is concluded that the quaternion based Kalman Filtering and Madgwick Filtering are both suitable to be implemented on a microprocessor with limited processing power. Both of the methods can decrease the measurement error caused by linear acceleration and magnetic field fluctuations due to interferences. There is almost no drifts after a long period of time (on the order of tens of seconds) when using these two methods. The differences is that the Kalman Filtering is more accurate when the IMU unit moves with low speed, while the Madgwick Filter works better in high speed movements.
This program running in the Arduino microcontroller is used for sending command to each sensor and receives data from them. Then the board puts them in package and transmits them to host computer.
This code has a document (133 pages) which describe the algorithm in detail.