1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

AHRS: Get the signs for the simple algorithm correct

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1385 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-08-23 04:12:14 +00:00 committed by peabody124
parent e94d3d3846
commit beac0c0ea9

View File

@ -353,8 +353,8 @@ int main()
/***************** SIMPLE ATTITUDE FROM NORTH AND ACCEL ************/ /***************** SIMPLE ATTITUDE FROM NORTH AND ACCEL ************/
/* Very simple computation of the heading and attitude from accel. */ /* Very simple computation of the heading and attitude from accel. */
rpy[2] = atan2((mag_data.raw.axis[0]), (-1 * mag_data.raw.axis[1])) * 180 / M_PI; rpy[2] = atan2((mag_data.raw.axis[0]), (-1 * mag_data.raw.axis[1])) * 180 / M_PI;
rpy[1] = -atan2(accel_data.filtered.x, accel_data.filtered.z) * 180 / M_PI; rpy[1] = atan2(accel_data.filtered.x, accel_data.filtered.z) * 180 / M_PI;
rpy[0] = -atan2(accel_data.filtered.y,accel_data.filtered.z) * 180 / M_PI; rpy[0] = atan2(accel_data.filtered.y,accel_data.filtered.z) * 180 / M_PI;
RPY2Quaternion(rpy,q); RPY2Quaternion(rpy,q);
attitude_data.quaternion.q1 = q[0]; attitude_data.quaternion.q1 = q[0];