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 authored and bresch committed Mar 17, 2020
1 parent eb3b0f6 commit fb1b6a0
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 @@ -587,6 +587,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
// TODO: 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 fb1b6a0

Please sign in to comment.