mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 21:03:34 +08:00
mc_att_control: don't keep att copy and avoid unnecessary Quatf construction and copies
This commit is contained in:
@@ -52,12 +52,11 @@ void AttitudeControl::setProportionalGain(const matrix::Vector3f &proportional_g
|
||||
}
|
||||
}
|
||||
|
||||
matrix::Vector3f AttitudeControl::update(matrix::Quatf q) const
|
||||
matrix::Vector3f AttitudeControl::update(const Quatf &q) const
|
||||
{
|
||||
Quatf qd = _attitude_setpoint_q;
|
||||
|
||||
// ensure input quaternions are exactly normalized because acosf(1.00001) == NaN
|
||||
q.normalize();
|
||||
qd.normalize();
|
||||
|
||||
// calculate reduced desired attitude neglecting vehicle's yaw to prioritize roll and pitch
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
* @param q estimation of the current vehicle attitude unit quaternion
|
||||
* @return [rad/s] body frame 3D angular rate setpoint vector to be executed by the rate controller
|
||||
*/
|
||||
matrix::Vector3f update(matrix::Quatf q) const;
|
||||
matrix::Vector3f update(const matrix::Quatf &q) const;
|
||||
|
||||
private:
|
||||
matrix::Vector3f _proportional_gain;
|
||||
|
||||
Reference in New Issue
Block a user