fw_att_control: add simple backup scheduling if vehicle_attitude unavailable (or stops)

This commit is contained in:
Daniel Agar
2022-07-20 00:53:37 -04:00
parent 1603883dc9
commit ace80e2b9d
2 changed files with 38 additions and 20 deletions
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2013-2019 PX4 Development Team. All rights reserved.
* Copyright (c) 2013-2022 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
@@ -48,7 +48,7 @@
#include <px4_platform_common/module_params.h>
#include <px4_platform_common/posix.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/px4_work_queue/WorkItem.hpp>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <uORB/Publication.hpp>
#include <uORB/PublicationMulti.hpp>
#include <uORB/Subscription.hpp>
@@ -83,7 +83,7 @@ static constexpr float kFlapSlewRate = 1.f; //minimum time from none to full fla
static constexpr float kSpoilerSlewRate = 1.f; //minimum time from none to full spoiler deflection [s]
class FixedwingAttitudeControl final : public ModuleBase<FixedwingAttitudeControl>, public ModuleParams,
public px4::WorkItem
public px4::ScheduledWorkItem
{
public:
FixedwingAttitudeControl(bool vtol = false);
@@ -139,6 +139,8 @@ private:
vehicle_rates_setpoint_s _rates_sp{};
vehicle_status_s _vehicle_status{};
matrix::Dcmf _R{matrix::eye<float, 3>()};
perf_counter_t _loop_perf;
hrt_abstime _last_run{0};