1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

AHRS/Matlab: Small bug in the quaternion transformation in case anyone else uses this :)

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1602 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-09-12 21:22:44 +00:00 committed by peabody124
parent 257b4d2c95
commit 10cfeeb35f

View File

@ -72,9 +72,10 @@ function rpy = Quaternion2RPY(q)
RAD2DEG = 180/pi;
q = bsxfun(@rdivide,q,sqrt(sum(q.^2,2)));
qs = q .* q;
R13 = 2*(q(:,1).*q(:,4) -q(:,1).*q(:,3)); %2*(q[1]*q[3]-q[0]*q[2]);
R13 = 2*(q(:,2).*q(:,4) -q(:,1).*q(:,3)); %2*(q[1]*q[3]-q[0]*q[2]);
R11 = qs(:,1) + qs(:,2) - qs(:,3) - qs(:,4); %q0s+q1s-q2s-q3s;
R12 = 2*(q(:,2).*q(:,3) + q(:,1).*q(:,4)); %2*(q[1]*q[2]+q[0]*q[3]);
R23 = 2*(q(:,3).*q(:,4) + q(:,1) .* q(:,2)); %2*(q[2]*q[3]+q[0]*q[1]);