Enables 20Hz backup scheduling for ControlAllocator

This commit is contained in:
Charles Cross
2022-02-22 12:52:17 -08:00
committed by Beat Küng
parent b0352135bb
commit aecfbef128
2 changed files with 5 additions and 2 deletions
@@ -51,7 +51,7 @@ using namespace time_literals;
ControlAllocator::ControlAllocator() : ControlAllocator::ControlAllocator() :
ModuleParams(nullptr), 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")) _loop_perf(perf_alloc(PC_ELAPSED, MODULE_NAME": cycle"))
{ {
for (int i = 0; i < MAX_NUM_MOTORS; ++i) { for (int i = 0; i < MAX_NUM_MOTORS; ++i) {
@@ -285,6 +285,9 @@ ControlAllocator::Run()
perf_begin(_loop_perf); perf_begin(_loop_perf);
// Push backup schedule
ScheduleDelayed(50_ms);
// Check if parameters have changed // Check if parameters have changed
if (_parameter_update_sub.updated() && !_armed) { if (_parameter_update_sub.updated() && !_armed) {
// clear update // clear update
@@ -74,7 +74,7 @@
#include <uORB/topics/vehicle_thrust_setpoint.h> #include <uORB/topics/vehicle_thrust_setpoint.h>
#include <uORB/topics/vehicle_status.h> #include <uORB/topics/vehicle_status.h>
class ControlAllocator : public ModuleBase<ControlAllocator>, public ModuleParams, public px4::WorkItem class ControlAllocator : public ModuleBase<ControlAllocator>, public ModuleParams, public px4::ScheduledWorkItem
{ {
public: public:
static constexpr int NUM_ACTUATORS = ControlAllocation::NUM_ACTUATORS; static constexpr int NUM_ACTUATORS = ControlAllocation::NUM_ACTUATORS;