资 源 简 介
This is a Direction Cosine Matrix (DCM) based Attitude Heading Reference System (AHRS) with gyro drift correction based on accelerometer (gravity) vector and magnetometer (compass) vector.
Hi all,
We have a full working version of the Razor 9DOF IMU AHRS :-). It´s uploaded in the Google Code repository at right.
I have included the code to read the I2C compass (HMC5843) and map the sensor axis and sensor signs (it was a little tricky...).
I have implemented the "fusion" between the 3 axis magnetometer info with our actual 6 DOF IMU code. This was my approach:
--Read the 3 axis magnetometer data
--Calculate the "tilt compensated" x and y magnetic component (standard formulation):
CMx = mag_x*cos(pitch) + mag_y*sin(roll)sin(pitch) + mag\_z*cos(roll)sin(pitch)
CMy = mag_y*cos(roll) - mag_z*sin(roll)
--Calculate the magnetic heading with this