Skip to content

Commit

Permalink
MulticopterPositionControl: improve tilt limit readability and scope
Browse files Browse the repository at this point in the history
according to @bresch's review comment.
  • Loading branch information
MaEtUgR committed Mar 31, 2021
1 parent 94469d8 commit c06b5a1
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/modules/mc_pos_control/MulticopterPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,9 @@ void MulticopterPositionControl::Run()
}

// limit tilt during takeoff ramupup
float tilt_limit = math::radians(_param_mpc_tiltmax_air.get());

if (_takeoff.getTakeoffState() < TakeoffState::flight) {
tilt_limit = math::radians(_param_mpc_tiltmax_lnd.get());
}

_control.setTiltLimit(_tilt_limit_slew_rate.update(tilt_limit, dt));
const float tilt_limit_deg = (_takeoff.getTakeoffState() < TakeoffState::flight)
? _param_mpc_tiltmax_lnd.get() : _param_mpc_tiltmax_air.get();
_control.setTiltLimit(_tilt_limit_slew_rate.update(math::radians(tilt_limit_deg), dt));

const float speed_up = _takeoff.updateRamp(dt,
PX4_ISFINITE(_vehicle_constraints.speed_up) ? _vehicle_constraints.speed_up : _param_mpc_z_vel_max_up.get());
Expand Down

0 comments on commit c06b5a1

Please sign in to comment.