mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-22 14:19:57 +08:00
fix(PositionControl): Prevent vehicle flipping on landing if MPC_ACC_DECOUPLE disabled (#27279)
* fix(PositionControl): create ground contact flag that prevents the z_specific_force being added to the z acceleration setpoint during landing. * fix(PositionControl): Combine setGroundContact with decoupleHorizontalAndVecticalAcceleration * docs(mc_pos_control): explain why decoupling is forced on the ground The PositionControl comment described a ground-contact exception that only the caller makes, and the caller's comment said what the line does rather than why it must match the idle setpoint condition. Assisted-by: Claude:claude-opus-5-5 --------- Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
1 parent
095a85ffc7
commit
e80c008909
1 file changed
+4
-1
@@ -195,7 +195,6 @@ void MulticopterPositionControl::parameters_update(bool force)
|
||||
Vector3f(_param_mpc_xy_vel_i_acc.get(), _param_mpc_xy_vel_i_acc.get(), _param_mpc_z_vel_i_acc.get()),
|
||||
Vector3f(_param_mpc_xy_vel_d_acc.get(), _param_mpc_xy_vel_d_acc.get(), _param_mpc_z_vel_d_acc.get()));
|
||||
_control.setHorizontalThrustMargin(_param_mpc_thr_xy_marg.get());
|
||||
_control.decoupleHorizontalAndVecticalAcceleration(_param_mpc_acc_decouple.get());
|
||||
_goto_control.setParamMpcAccHor(_param_mpc_acc_hor.get());
|
||||
_goto_control.setParamMpcAccDownMax(_param_mpc_acc_down_max.get());
|
||||
_goto_control.setParamMpcAccUpMax(_param_mpc_acc_up_max.get());
|
||||
@@ -497,6 +496,10 @@ void MulticopterPositionControl::Run()
|
||||
const bool flying = (_takeoff.getTakeoffState() >= TakeoffState::flight);
|
||||
const bool flying_but_ground_contact = (flying && _vehicle_land_detected.ground_contact);
|
||||
|
||||
// Same condition as the [0, 0, 100] idle setpoint below: coupled, it points body_z down
|
||||
// and limitTilt commands full tilt
|
||||
_control.decoupleHorizontalAndVecticalAcceleration(_param_mpc_acc_decouple.get() || not_taken_off || flying_but_ground_contact);
|
||||
|
||||
if (!flying) {
|
||||
_control.setHoverThrust(_param_mpc_thr_hover.get());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user