Skip to content

Commit

Permalink
position control reset tilt limit and hover thrust in non-position mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Martin committed Dec 13, 2024
1 parent cc92979 commit 64e4fb5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/modules/mc_pos_control/MulticopterPositionControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,15 @@ void MulticopterPositionControl::Run()
// an update is necessary here because otherwise the takeoff state doesn't get skipped with non-altitude-controlled modes
_takeoff.updateTakeoffState(_vehicle_control_mode.flag_armed, _vehicle_land_detected.landed, false, 10.f, true,
vehicle_local_position.timestamp_sample);

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

if (_takeoff.getTakeoffState() < TakeoffState::flight) {
_control.setHoverThrust(_param_mpc_thr_hover.get());
}

_control.resetIntegral();
}

Expand Down

0 comments on commit 64e4fb5

Please sign in to comment.