dcm-imu
The DCM-IMU algorithm is designed for fusing low-cost triaxial MEMS gyroscope and accelerometer measurements. An extended Kalman filter is used to estimate attitude in direction cosine matrix (DCM) formation and gyroscope biases online. A variable measurement covariance method is implemented for acceleration measurements to ensure robustness against transient non-gravitational accelerations which usually induce errors to attitude estimate in ordinary IMU-algorithms.
If you use the algorithm in any scientific context, please cite: Heikki Hyyti and Arto Visala, "A DCM Based Attitude Estimation Algorithm for Low-Cost MEMS IMUs," International Journal of Navigation and Observation, vol. 2015, Article ID 503814, 18 pages, 2015. http://dx.doi.org/10.1155/2015/503814
If you would like to use comparison algorithms by Sebastian Madgwick, download them from http://www.x-io.co.uk/open-source-imu-and-ahrs-algorithms/ and copy c-implementations under c/MahonyAHRS/ (MahonyAHRS.cpp and MahonyAHRS.h) and c/MadgwickAHRS/ (MadgwickAHRS.cpp and MadgwickAHRS.h) folders. The c files have to be renamed as cpp files in order to allow Matlab to compile them correctly. Also, the DCM_IMU c code includes Eigen3 matrix library and Matlab headers. Please, install Eigen3 and change the paths inside compile.m to the paths on your computer before compiling. In addition, copy folders @MadgwickAHRS, @MahonyAHRS and quaternion_library into the main folder from the provided Matlab code by Madgwick. These files are not added into this repository as they are provided under GPL licence and this work is under MIT licence.
Updates
2017-06-01: An alternative yaw-angle estimation method is now added to DCM_IMU matlab and c++ code versions. It integrates the whole rotation matrix without the need for computing sines or cosines from the estimated angles. However, it is currently inactivated as it is slightly slower to compute. In addition, also a more microcontroller suitable version of the DCM_IMU c code is now provided under c/DCM_IMU_uC folder. It uses only 32bit floats and works without the external matrix library (Eigen3). It is also a lot faster than the previous version. If you want to avoid installing Eigen3, you can use only the uC version of C code with Matlab. Then you should comment the normal C code version out from the compile.m file to be able to compile other than Eigen dependent codes, and replace DCM_IMU_C with DCM_IMU_uC in plotIMUsWithKuka.m and plotIMUsWithKuka_biasTest.m Matlab files.