diff --git a/src/modules/mc_pos_control/MulticopterPositionControl.cpp b/src/modules/mc_pos_control/MulticopterPositionControl.cpp index d3286423c9..e55476a707 100644 --- a/src/modules/mc_pos_control/MulticopterPositionControl.cpp +++ b/src/modules/mc_pos_control/MulticopterPositionControl.cpp @@ -404,9 +404,11 @@ void MulticopterPositionControl::Run() _control.setInputSetpoint(_setpoint); // update states - if (PX4_ISFINITE(_setpoint.vz) && (fabsf(_setpoint.vz) > FLT_EPSILON) + if (!PX4_ISFINITE(_setpoint.z) + && PX4_ISFINITE(_setpoint.vz) && (fabsf(_setpoint.vz) > FLT_EPSILON) && PX4_ISFINITE(local_pos.z_deriv) && local_pos.z_valid && local_pos.v_z_valid) { - // A change in velocity is demanded. Set velocity to the derivative of position + // A change in velocity is demanded and the altitude is not controlled. + // Set velocity to the derivative of position // because it has less bias but blend it in across the landing speed range // < MPC_LAND_SPEED: ramp up using altitude derivative without a step // >= MPC_LAND_SPEED: use altitude derivative