fw_att_control: move to WQ with uORB callback scheduling

This commit is contained in:
Daniel Agar
2019-08-07 22:54:44 -04:00
committed by GitHub
parent 0955fd2d58
commit cab0aee2a0
2 changed files with 375 additions and 403 deletions
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013-2017 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,7 +46,9 @@
#include <px4_tasks.h>
#include <parameters/param.h>
#include <perf/perf_counter.h>
#include <px4_work_queue/WorkItem.hpp>
#include <uORB/Subscription.hpp>
#include <uORB/SubscriptionCallback.hpp>
#include <uORB/topics/actuator_controls.h>
#include <uORB/topics/airspeed.h>
#include <uORB/topics/battery_status.h>
@@ -67,7 +69,7 @@ using matrix::Quatf;
using uORB::SubscriptionData;
class FixedwingAttitudeControl final : public ModuleBase<FixedwingAttitudeControl>
class FixedwingAttitudeControl final : public ModuleBase<FixedwingAttitudeControl>, public px4::WorkItem
{
public:
FixedwingAttitudeControl();
@@ -76,24 +78,22 @@ public:
/** @see ModuleBase */
static int task_spawn(int argc, char *argv[]);
/** @see ModuleBase */
static FixedwingAttitudeControl *instantiate(int argc, char *argv[]);
/** @see ModuleBase */
static int custom_command(int argc, char *argv[]);
/** @see ModuleBase */
static int print_usage(const char *reason = nullptr);
/** @see ModuleBase::run() */
void run() override;
/** @see ModuleBase::print_status() */
int print_status() override;
void Run() override;
bool init();
private:
int _att_sub{-1}; /**< vehicle attitude */
uORB::SubscriptionCallbackWorkItem _att_sub{this, ORB_ID(vehicle_attitude)}; /**< vehicle attitude */
uORB::Subscription _att_sp_sub{ORB_ID(vehicle_attitude_setpoint)}; /**< vehicle attitude setpoint */
uORB::Subscription _battery_status_sub{ORB_ID(battery_status)}; /**< battery status subscription */
@@ -128,8 +128,7 @@ private:
vehicle_status_s _vehicle_status {}; /**< vehicle status */
perf_counter_t _loop_perf; /**< loop performance counter */
perf_counter_t _nonfinite_input_perf; /**< performance counter for non finite input */
perf_counter_t _nonfinite_output_perf; /**< performance counter for non finite output */
perf_counter_t _loop_interval_perf; /**< loop interval performance counter */
float _flaps_applied{0.0f};
float _flaperons_applied{0.0f};