mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-01 04:11:36 +08:00
Added quaternion renormalization
This commit is contained in:
@@ -131,6 +131,8 @@ void ECL_FWAttControlVector::control(float dt, float airspeed, float airspeed_sc
|
|||||||
// XXX switch between operations based on difference,
|
// XXX switch between operations based on difference,
|
||||||
// benchmark both options
|
// benchmark both options
|
||||||
math::Quaternion e_q = math::Quaternion(R_des) - math::Quaternion(R_bn);
|
math::Quaternion e_q = math::Quaternion(R_des) - math::Quaternion(R_bn);
|
||||||
|
// Renormalize
|
||||||
|
e_q = e_q / e_q.norm();
|
||||||
math::Matrix e_R = math::Dcm(e_q);
|
math::Matrix e_R = math::Dcm(e_q);
|
||||||
//small angles: math::Matrix e_R = (R_des.transpose() * R_bn - R_bn.transpose() * R_des) * 0.5f;
|
//small angles: math::Matrix e_R = (R_des.transpose() * R_bn - R_bn.transpose() * R_des) * 0.5f;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user