mixer_multirotor: use reduce_only instead of -1000 for yaw thrust reduction

This is more accurate, because if we use -1000 as lower bound, a very large
yaw command can reduce thrust more than needed.

The difference can be seen in the following example
(with roll/pitch airmode):
p_dot_sp = -1.0 # roll acceleration
q_dot_sp = 0.9 # pitch acceleration
r_dot_sp = -0.9 # yaw acceleration
This commit is contained in:
Beat Küng
2018-12-11 18:47:33 +01:00
parent 418df2516d
commit cfad556a16
2 changed files with 6 additions and 2 deletions
+2 -1
View File
@@ -339,7 +339,8 @@ void MultirotorMixer::mix_yaw(float yaw, float *outputs)
_tmp_array[i] = _rotors[i].thrust_scale;
}
minimize_saturation(_tmp_array, outputs, _saturation_status, -1000.f);
// reduce thrust only
minimize_saturation(_tmp_array, outputs, _saturation_status, 0.f, 1.f, true);
}
unsigned
+4 -1
View File
@@ -92,7 +92,10 @@ def mix_yaw(m_sp, u, P, u_min, u_max):
u_r_dot = P[:,2]
u_pp = minimize_sat(u_p, u_min, u_max+0.15, u_r_dot)
u_T = P[:, 3]
u_ppp = minimize_sat(u_pp, -1000, u_max, u_T)
u_ppp = minimize_sat(u_pp, 0, u_max, u_T)
# reduce thrust only
if (u_ppp > (u_pp)).any():
u_ppp = u_pp
return u_ppp
def airmode_rp(m_sp, P, u_min, u_max):