mc_att_control: don't keep att copy and avoid unnecessary Quatf construction and copies

This commit is contained in:
Daniel Agar
2020-08-10 14:07:42 -04:00
parent 5e739f66d6
commit 1c42d12491
4 changed files with 20 additions and 20 deletions
@@ -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;