AHRS based on MatrixPilot DCM algorithm; ported from Pololu MinIMU-9 example code in turn based on ArduPilot 1.5 built for sensor gy_80
Fork of DCM_AHRS by
Diff: DCM.cpp
- Revision:
- 5:d5ecdb82c17b
- Parent:
- 4:4c6ffd1a88ce
- Child:
- 6:49cbf2acc4e6
--- a/DCM.cpp Fri Jul 26 02:42:14 2013 +0000 +++ b/DCM.cpp Fri Jul 26 04:02:53 2013 +0000 @@ -35,6 +35,7 @@ for (int n=0; n < 3; n++) { dcm[m][n] = (m == n) ? 1 : 0; // dcm starts as identity matrix } + } } @@ -151,9 +152,9 @@ void DCM::Euler_angles(void) { - pitch = RAD2DEG(-asin(dcm[2][0])); - roll = RAD2DEG(atan2(dcm[2][1],dcm[2][2])); - yaw = RAD2DEG(atan2(dcm[1][0],dcm[0][0])); + pitch = RAD2DEG(-asin(dcm[2][0])); + roll = RAD2DEG(atan2(dcm[2][1],dcm[2][2])); + yaw = RAD2DEG(atan2(dcm[1][0],dcm[0][0])); } void DCM::Update_step(float dt)