mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Attitude: Keep first element of quaternion positive
This commit is contained in:
parent
247da8c24b
commit
ec2121bca8
@ -329,6 +329,13 @@ static void updateAttitude(AttitudeRawData * attitudeRaw)
|
|||||||
q[1] = q[1] + qdot[1];
|
q[1] = q[1] + qdot[1];
|
||||||
q[2] = q[2] + qdot[2];
|
q[2] = q[2] + qdot[2];
|
||||||
q[3] = q[3] + qdot[3];
|
q[3] = q[3] + qdot[3];
|
||||||
|
|
||||||
|
if(q[0] < 0) {
|
||||||
|
q[0] = -q[0];
|
||||||
|
q[1] = -q[1];
|
||||||
|
q[2] = -q[2];
|
||||||
|
q[3] = -q[3];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Renomalize
|
// Renomalize
|
||||||
|
Loading…
x
Reference in New Issue
Block a user