Skip to content

Commit

Permalink
mc_pos_control: hotfix for takeoff ramp stuck with NAN
Browse files Browse the repository at this point in the history
Reported by @dusan19 in #13973.
  • Loading branch information
MaEtUgR committed Mar 10, 2020
1 parent 05caa1f commit fad9002
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/mc_pos_control/mc_pos_control_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,12 @@ MulticopterPositionControl::Run()
// check if all local states are valid and map accordingly
set_vehicle_states(setpoint.vz);

// fix to prevent the takeoff ramp to ramp to a too high value or get stuck because of NAN
// this should get obsolete once the takeoff limiting moves into the flight tasks
if (!PX4_ISFINITE(constraints.speed_up) || (constraints.speed_up > _param_mpc_z_vel_max_up.get())) {
constraints.speed_up = _param_mpc_z_vel_max_up.get();
}

// handle smooth takeoff
_takeoff.updateTakeoffState(_control_mode.flag_armed, _vehicle_land_detected.landed, constraints.want_takeoff,
constraints.speed_up, !_control_mode.flag_control_climb_rate_enabled, time_stamp_now);
Expand Down

0 comments on commit fad9002

Please sign in to comment.