From aecfbef128d72066580d904607ce4ca45b7d0804 Mon Sep 17 00:00:00 2001 From: Charles Cross Date: Tue, 22 Feb 2022 12:52:17 -0800 Subject: [PATCH] Enables 20Hz backup scheduling for ControlAllocator --- src/modules/control_allocator/ControlAllocator.cpp | 5 ++++- src/modules/control_allocator/ControlAllocator.hpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/modules/control_allocator/ControlAllocator.cpp b/src/modules/control_allocator/ControlAllocator.cpp index 07c9a9f5a3..1f0769b196 100644 --- a/src/modules/control_allocator/ControlAllocator.cpp +++ b/src/modules/control_allocator/ControlAllocator.cpp @@ -51,7 +51,7 @@ using namespace time_literals; ControlAllocator::ControlAllocator() : ModuleParams(nullptr), - WorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl), + ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl), _loop_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": cycle")) { for (int i = 0; i < MAX_NUM_MOTORS; ++i) { @@ -285,6 +285,9 @@ ControlAllocator::Run() perf_begin(_loop_perf); + // Push backup schedule + ScheduleDelayed(50_ms); + // Check if parameters have changed if (_parameter_update_sub.updated() && !_armed) { // clear update diff --git a/src/modules/control_allocator/ControlAllocator.hpp b/src/modules/control_allocator/ControlAllocator.hpp index f1ea6888dc..033a43156b 100644 --- a/src/modules/control_allocator/ControlAllocator.hpp +++ b/src/modules/control_allocator/ControlAllocator.hpp @@ -74,7 +74,7 @@ #include #include -class ControlAllocator : public ModuleBase, public ModuleParams, public px4::WorkItem +class ControlAllocator : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem { public: static constexpr int NUM_ACTUATORS = ControlAllocation::NUM_ACTUATORS;