mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-25 13:31:27 +08:00
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:
committed by
Mathieu Bresciani
parent
ba1b7f3a07
commit
ba66f8a1e2
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user