mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 08:36:08 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user