mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-04 08:20:35 +08:00
DCM: use simplified conversion from unit quaternion
This is exactly equivalent for a unit quaternion (and only unit quaternions should be used to encode a rotation)
This commit is contained in:
@@ -90,7 +90,6 @@ public:
|
||||
const Type b = q(1);
|
||||
const Type c = q(2);
|
||||
const Type d = q(3);
|
||||
const Type aa = a * a;
|
||||
const Type ab = a * b;
|
||||
const Type ac = a * c;
|
||||
const Type ad = a * d;
|
||||
@@ -100,15 +99,15 @@ public:
|
||||
const Type cc = c * c;
|
||||
const Type cd = c * d;
|
||||
const Type dd = d * d;
|
||||
dcm(0, 0) = aa + bb - cc - dd;
|
||||
dcm(0, 0) = Type(1) - Type(2) * (cc + dd);
|
||||
dcm(0, 1) = Type(2) * (bc - ad);
|
||||
dcm(0, 2) = Type(2) * (ac + bd);
|
||||
dcm(1, 0) = Type(2) * (bc + ad);
|
||||
dcm(1, 1) = aa - bb + cc - dd;
|
||||
dcm(1, 1) = Type(1) - Type(2) * (bb + dd);
|
||||
dcm(1, 2) = Type(2) * (cd - ab);
|
||||
dcm(2, 0) = Type(2) * (bd - ac);
|
||||
dcm(2, 1) = Type(2) * (ab + cd);
|
||||
dcm(2, 2) = aa - bb - cc + dd;
|
||||
dcm(2, 2) = Type(1) - Type(2) * (bb + cc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user