reset hover thrust value in controllers when disarmed

During landing, hover thrust value can be very incorrect so it should be
reset before taking off
This commit is contained in:
Nicolas Martin
2021-10-01 14:24:56 +02:00
committed by Mathieu Bresciani
parent ba1b7f3a07
commit ba66f8a1e2
2 changed files with 11 additions and 3 deletions

View File

@@ -96,7 +96,8 @@ AngularVelocityController::parameters_updated()
_control.setInertiaMatrix(matrix::Matrix3f(inertia));
// Hover thrust
if (!_param_mpc_use_hte.get()) {
if (!_param_mpc_use_hte.get()
|| !_vehicle_control_mode.flag_armed) {
_hover_thrust = _param_mpc_thr_hover.get();
}
}
@@ -149,11 +150,16 @@ AngularVelocityController::Run()
}
// Check for updates of hover thrust
if (_param_mpc_use_hte.get()) {
if (!_vehicle_control_mode.flag_armed) {
_hover_thrust = _param_mpc_thr_hover.get();
} else if (_param_mpc_use_hte.get()) {
hover_thrust_estimate_s hte;
if (_hover_thrust_estimate_sub.update(&hte)) {
_hover_thrust = hte.hover_thrust;
if (hte.valid) {
_hover_thrust = hte.hover_thrust;
}
}
}

View File

@@ -394,6 +394,8 @@ void MulticopterPositionControl::Run()
// make sure takeoff ramp is not amended by acceleration feed-forward
if (!flying) {
_setpoint.acceleration[2] = NAN;
// hover_thrust maybe reset on takeoff
_control.setHoverThrust(_param_mpc_thr_hover.get());
}
const bool not_taken_off = (_takeoff.getTakeoffState() < TakeoffState::rampup);