From 51ca01ce040a58decfa8af138de12752b37abefd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Tue, 20 Mar 2018 11:19:54 +0100 Subject: [PATCH] FixedwingAttitudeControl: remove SuperBlock dependency --- .../fw_att_control/FixedwingAttitudeControl.cpp | 11 +++++------ .../fw_att_control/FixedwingAttitudeControl.hpp | 6 ++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp index 0338c81c4c..07d36f2786 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp @@ -41,8 +41,7 @@ extern "C" __EXPORT int fw_att_control_main(int argc, char *argv[]); FixedwingAttitudeControl::FixedwingAttitudeControl() : - SuperBlock(nullptr, "FW_ATT"), - _sub_airspeed(ORB_ID(airspeed), 0, 0, &getSubscriptions()), + _airspeed_sub(ORB_ID(airspeed)), /* performance counters */ _loop_perf(perf_alloc(PC_ELAPSED, "fwa_dt")), @@ -527,7 +526,7 @@ void FixedwingAttitudeControl::run() matrix::Eulerf euler_angles(R); - updateSubscriptions(); + _airspeed_sub.update(); vehicle_setpoint_poll(); vehicle_control_mode_poll(); vehicle_manual_poll(); @@ -563,12 +562,12 @@ void FixedwingAttitudeControl::run() float airspeed; /* if airspeed is non-finite or not valid or if we are asked not to control it, we assume the normal average speed */ - const bool airspeed_valid = PX4_ISFINITE(_sub_airspeed.get().indicated_airspeed_m_s) - && (hrt_elapsed_time(&_sub_airspeed.get().timestamp) < 1e6); + const bool airspeed_valid = PX4_ISFINITE(_airspeed_sub.get().indicated_airspeed_m_s) + && (hrt_elapsed_time(&_airspeed_sub.get().timestamp) < 1e6); if (airspeed_valid) { /* prevent numerical drama by requiring 0.5 m/s minimal speed */ - airspeed = math::max(0.5f, _sub_airspeed.get().indicated_airspeed_m_s); + airspeed = math::max(0.5f, _airspeed_sub.get().indicated_airspeed_m_s); } else { airspeed = _parameters.airspeed_trim; diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.hpp b/src/modules/fw_att_control/FixedwingAttitudeControl.hpp index e790b44c6a..1c09d1a7d1 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.hpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.hpp @@ -31,8 +31,6 @@ * ****************************************************************************/ -#include -#include #include #include #include @@ -68,7 +66,7 @@ using matrix::Quatf; using uORB::Subscription; -class FixedwingAttitudeControl final : public control::SuperBlock, public ModuleBase +class FixedwingAttitudeControl final : public ModuleBase { public: FixedwingAttitudeControl(); @@ -124,7 +122,7 @@ private: vehicle_rates_setpoint_s _rates_sp {}; /* attitude rates setpoint */ vehicle_status_s _vehicle_status {}; /**< vehicle status */ - Subscription _sub_airspeed; + Subscription _airspeed_sub; perf_counter_t _loop_perf; /**< loop performance counter */ perf_counter_t _nonfinite_input_perf; /**< performance counter for non finite input */