VTOL tailsitter: fix motor spike to 0 when finishing front transition

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
Silvan Fuhrer
2024-04-19 17:18:21 +02:00
parent 1f7b4843dd
commit a081354933
3 changed files with 9 additions and 0 deletions
@@ -281,6 +281,12 @@ void Tailsitter::fill_actuator_outputs()
_thrust_setpoint_0->xyz[2] = -_vehicle_thrust_setpoint_virtual_fw->xyz[0];
// for the short period after switching to FW where there is no thrust published yet from the FW controller,
// keep publishing the last MC thrust to keep the motors running
if (hrt_elapsed_time(&_trans_finished_ts) < 50_ms) {
_thrust_setpoint_0->xyz[2] = _last_thr_in_mc;
}
/* allow differential thrust if enabled */
if (_param_vt_fw_difthr_en.get() & static_cast<int32_t>(VtFwDifthrEnBits::YAW_BIT)) {
_torque_setpoint_0->xyz[0] = _vehicle_torque_setpoint_virtual_fw->xyz[0] * _param_vt_fw_difthr_s_y.get();
@@ -164,6 +164,8 @@ void VtolType::update_transition_state()
_time_since_trans_start = (float)(t_now - _transition_start_timestamp) * 1e-6f;
check_quadchute_condition();
_last_thr_in_mc = _vehicle_thrust_setpoint_virtual_mc->xyz[2];
}
float VtolType::update_and_get_backtransition_pitch_sp()
+1
View File
@@ -299,6 +299,7 @@ protected:
// motors spinning up or cutting too fast when doing transitions.
float _thrust_transition = 0.0f; // thrust value applied during a front transition (tailsitter & tiltrotor only)
float _last_thr_in_fw_mode = 0.0f;
float _last_thr_in_mc = 0.f;
hrt_abstime _trans_finished_ts = 0;
hrt_abstime _transition_start_timestamp{0};