From 032ae69eeef7ec74c238f0de52c1e4c8070081ea Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Wed, 22 May 2024 16:53:23 +0200 Subject: [PATCH] VTOL: remove _dt passing as it's no longer used (and was wrong) Signed-off-by: Silvan Fuhrer --- src/modules/vtol_att_control/vtol_att_control_main.cpp | 9 ++------- src/modules/vtol_att_control/vtol_att_control_main.h | 6 +++--- src/modules/vtol_att_control/vtol_type.h | 8 -------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/modules/vtol_att_control/vtol_att_control_main.cpp b/src/modules/vtol_att_control/vtol_att_control_main.cpp index b464793c99..199dcac84c 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.cpp +++ b/src/modules/vtol_att_control/vtol_att_control_main.cpp @@ -284,10 +284,10 @@ VtolAttitudeControl::Run() return; } - const hrt_abstime now = hrt_absolute_time(); - #if !defined(ENABLE_LOCKSTEP_SCHEDULER) + const hrt_abstime now = hrt_absolute_time(); + // prevent excessive scheduling (> 500 Hz) if (now - _last_run_timestamp < 2_ms) { return; @@ -295,9 +295,6 @@ VtolAttitudeControl::Run() #endif // !ENABLE_LOCKSTEP_SCHEDULER - const float dt = math::min((now - _last_run_timestamp) / 1e6f, kMaxVTOLAttitudeControlTimeStep); - _last_run_timestamp = now; - if (!_initialized) { if (_vtol_type->init()) { @@ -309,8 +306,6 @@ VtolAttitudeControl::Run() } } - _vtol_type->setDt(dt); - perf_begin(_loop_perf); bool updated_fw_in = _vehicle_torque_setpoint_virtual_fw_sub.update(&_vehicle_torque_setpoint_virtual_fw); diff --git a/src/modules/vtol_att_control/vtol_att_control_main.h b/src/modules/vtol_att_control/vtol_att_control_main.h index 132448177f..6ef046f05f 100644 --- a/src/modules/vtol_att_control/vtol_att_control_main.h +++ b/src/modules/vtol_att_control/vtol_att_control_main.h @@ -92,8 +92,6 @@ using namespace time_literals; extern "C" __EXPORT int vtol_att_control_main(int argc, char *argv[]); -static constexpr float kMaxVTOLAttitudeControlTimeStep = 0.1f; // max time step [s] - class VtolAttitudeControl : public ModuleBase, public ModuleParams, public px4::WorkItem { public: @@ -211,7 +209,9 @@ private: float _air_density{atmosphere::kAirDensitySeaLevelStandardAtmos}; // [kg/m^3] - hrt_abstime _last_run_timestamp{0}; +#if !defined(ENABLE_LOCKSTEP_SCHEDULER) + hrt_abstime _last_run_timestamp {0}; +#endif // !ENABLE_LOCKSTEP_SCHEDULER /* For multicopters it is usual to have a non-zero idle speed of the engines * for fixed wings we want to have an idle speed of zero since we do not want diff --git a/src/modules/vtol_att_control/vtol_type.h b/src/modules/vtol_att_control/vtol_type.h index d59887372e..78d078b5c8 100644 --- a/src/modules/vtol_att_control/vtol_type.h +++ b/src/modules/vtol_att_control/vtol_type.h @@ -251,12 +251,6 @@ public: virtual void parameters_update() = 0; - /** - * @brief Set current time delta - * - * @param dt Current time delta [s] - */ - void setDt(float dt) {_dt = dt; } /** * @brief Resets the transition timer states. @@ -326,8 +320,6 @@ protected: bool isFrontTransitionCompleted(); virtual bool isFrontTransitionCompletedBase(); - float _dt{0.0025f}; // time step [s] - float _local_position_z_start_of_transition{0.f}; // altitude at start of transition int _altitude_reset_counter{0};