From 777a264ab49fed23e4e1246616fb9269161f5da7 Mon Sep 17 00:00:00 2001 From: RomanBapst Date: Wed, 8 Jan 2025 11:18:03 +0300 Subject: [PATCH] more cleanup Signed-off-by: RomanBapst --- .../FwLateralLongitudinalControl.cpp | 6 +++--- .../FwLateralLongitudinalControl.hpp | 4 ++-- .../fw_pos_control/FixedwingPositionControl.cpp | 11 +++-------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp index fd904c5b212b..7a97f362126f 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp @@ -212,6 +212,7 @@ void FwLateralLongitudinalControl::Run() _fw_lateral_ctrl_sub.copy(&lateral_sp); if (lateral_sp.timestamp > 0 && hrt_elapsed_time(&lateral_sp.timestamp) < 1_s) { + publish = true; float airspeed_reference_direction{NAN}; float lateral_accel_sp {NAN}; @@ -258,7 +259,6 @@ void FwLateralLongitudinalControl::Run() }; _lateral_ctrl_status_pub.publish(status); - publish = true; } @@ -580,7 +580,7 @@ void FwLateralLongitudinalControl::updateAirspeed() { _airspeed_valid = airspeed_valid; } } -bool FwLateralLongitudinalControl::checkLowHeightConditions() +bool FwLateralLongitudinalControl::checkLowHeightConditions() const { // Are conditions for low-height return _param_fw_t_thr_low_hgt.get() >= 0.f && _local_pos.dist_bottom_valid @@ -664,7 +664,7 @@ float FwLateralLongitudinalControl::getCorrectedLateralAccelSetpoint(float later return can_run_factor * (lateral_accel_sp); } -float FwLateralLongitudinalControl::mapLateralAccelerationToRollAngle(float lateral_acceleration_sp) { +float FwLateralLongitudinalControl::mapLateralAccelerationToRollAngle(float lateral_acceleration_sp) const { return atanf(lateral_acceleration_sp * 1.0f / CONSTANTS_ONE_G); } diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp index 8b73d1fae22b..b874a934e94d 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.hpp @@ -214,13 +214,13 @@ class FwLateralLongitudinalControl final : public ModuleBase