mc mixer: prioritize roll/pitch over yaw for full airmode

Improves roll/pitch tracking in situations of large yaw demands.
This commit is contained in:
Beat Küng 2019-06-05 15:08:28 +02:00 committed by Mathieu Bresciani
parent 8811c8315c
commit beaba44e5b
3 changed files with 17 additions and 2 deletions

View File

@ -773,7 +773,8 @@ private:
* Mix roll, pitch, yaw, thrust and set the outputs vector.
*
* Desaturation behavior: full airmode for roll/pitch/yaw:
* thrust is increased/decreased as much as required to meet demanded the roll/pitch/yaw.
* thrust is increased/decreased as much as required to meet demanded the roll/pitch/yaw,
* while giving priority to roll and pitch over yaw.
*/
inline void mix_airmode_rpy(float roll, float pitch, float yaw, float thrust, float *outputs);

View File

@ -285,6 +285,14 @@ void MultirotorMixer::mix_airmode_rpy(float roll, float pitch, float yaw, float
}
minimize_saturation(_tmp_array, outputs, _saturation_status);
// Unsaturate yaw (in case upper and lower bounds are exceeded)
// to prioritize roll/pitch over yaw.
for (unsigned i = 0; i < _rotor_count; i++) {
_tmp_array[i] = _rotors[i].yaw_scale;
}
minimize_saturation(_tmp_array, outputs, _saturation_status);
}
void MultirotorMixer::mix_airmode_disabled(float roll, float pitch, float yaw, float thrust, float *outputs)

View File

@ -134,7 +134,13 @@ def airmode_rpy(m_sp, P, u_min, u_max):
# Use thrust to unsaturate the outputs if needed
u_T = P[:, 3]
u_prime = minimize_sat(u, u_min, u_max, u_T)
return (u, u_prime)
# Unsaturate yaw (in case upper and lower bounds are exceeded)
# to prioritize roll/pitch over yaw.
u_T = P[:, 2]
u_prime_yaw = minimize_sat(u_prime, u_min, u_max, u_T)
return (u, u_prime_yaw)
def normal_mode(m_sp, P, u_min, u_max):