mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 16:33:33 +08:00
Rework landing gear logic
- remove deprecated actuator_controls[INDEX_LANDING_GEAR] - remove dead code in mc rate controller that used to prevent it from being retracted on the ground (anyway had no effect as it only affected the actuator_control[LANDING_GEAR] which wasn't sent to the control allocation) - for VTOLs handle deployment/retraction of landing gear in AUTO as a MC (retract if more than 2m above ground, deploy if WP is a landing WP), plus additionally when transition flight task is called (ALTITUDE mode and higher) - for FW in AUTO: add logic in FW Position Controller, depending on waypoint type mainly - manual landing gear settings always come through (a manual command overrides a previous auto command, and vice-versa) Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
@@ -36,6 +36,13 @@
|
||||
|
||||
#include "FlightTaskDescend.hpp"
|
||||
|
||||
bool FlightTaskDescend::activate(const trajectory_setpoint_s &last_setpoint)
|
||||
{
|
||||
bool ret = FlightTask::activate(last_setpoint);
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool FlightTaskDescend::update()
|
||||
{
|
||||
bool ret = FlightTask::update();
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
virtual ~FlightTaskDescend() = default;
|
||||
|
||||
bool update() override;
|
||||
bool activate(const trajectory_setpoint_s &last_setpoint) override;
|
||||
|
||||
private:
|
||||
Sticks _sticks{this};
|
||||
|
||||
@@ -57,7 +57,7 @@ bool FlightTaskTransition::updateInitialize()
|
||||
|
||||
void FlightTaskTransition::updateParameters()
|
||||
{
|
||||
// check for parameter updates
|
||||
// check for parameter updates
|
||||
if (_parameter_update_sub.updated()) {
|
||||
// clear update
|
||||
parameter_update_s pupdate;
|
||||
@@ -85,9 +85,19 @@ bool FlightTaskTransition::activate(const trajectory_setpoint_s &last_setpoint)
|
||||
|
||||
_velocity_setpoint(2) = _vel_z_filter.getState();
|
||||
|
||||
_sub_vehicle_status.update();
|
||||
|
||||
const bool is_vtol_front_transition = _sub_vehicle_status.get().in_transition_mode
|
||||
&& _sub_vehicle_status.get().in_transition_to_fw;
|
||||
|
||||
if (is_vtol_front_transition) {
|
||||
_gear.landing_gear = landing_gear_s::GEAR_UP;
|
||||
|
||||
} else {
|
||||
_gear.landing_gear = landing_gear_s::GEAR_DOWN;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
|
||||
}
|
||||
|
||||
bool FlightTaskTransition::update()
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <lib/mathlib/math/filter/AlphaFilter.hpp>
|
||||
#include <uORB/SubscriptionInterval.hpp>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
#include <uORB/topics/vehicle_status.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
using namespace time_literals;
|
||||
@@ -63,6 +64,9 @@ private:
|
||||
static constexpr float _vel_z_filter_time_const = 2.0f;
|
||||
|
||||
uORB::SubscriptionInterval _parameter_update_sub{ORB_ID(parameter_update), 1_s};
|
||||
|
||||
uORB::SubscriptionData<vehicle_status_s> _sub_vehicle_status{ORB_ID(vehicle_status)};
|
||||
|
||||
param_t _param_handle_pitch_cruise_degrees{PARAM_INVALID};
|
||||
float _param_pitch_cruise_degrees{0.f};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user