mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 05:33:34 +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:
@@ -145,24 +145,6 @@ MulticopterRateControl::Run()
|
||||
|
||||
_vehicle_status_sub.update(&_vehicle_status);
|
||||
|
||||
if (_landing_gear_sub.updated()) {
|
||||
landing_gear_s landing_gear;
|
||||
|
||||
if (_landing_gear_sub.copy(&landing_gear)) {
|
||||
if (landing_gear.landing_gear != landing_gear_s::GEAR_KEEP) {
|
||||
if (landing_gear.landing_gear == landing_gear_s::GEAR_UP && (_landed || _maybe_landed)) {
|
||||
mavlink_log_critical(&_mavlink_log_pub, "Landed, unable to retract landing gear\t");
|
||||
events::send(events::ID("mc_rate_control_not_retract_landing_gear_landed"),
|
||||
{events::Log::Error, events::LogInternal::Info},
|
||||
"Landed, unable to retract landing gear");
|
||||
|
||||
} else {
|
||||
_landing_gear = landing_gear.landing_gear;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// use rates setpoint topic
|
||||
vehicle_rates_setpoint_s vehicle_rates_setpoint{};
|
||||
|
||||
@@ -246,7 +228,6 @@ MulticopterRateControl::Run()
|
||||
actuators.control[actuator_controls_s::INDEX_YAW] = PX4_ISFINITE(att_control(2)) ? att_control(2) : 0.0f;
|
||||
actuators.control[actuator_controls_s::INDEX_THROTTLE] = PX4_ISFINITE(_thrust_setpoint(2)) ? -_thrust_setpoint(
|
||||
2) : 0.0f;
|
||||
actuators.control[actuator_controls_s::INDEX_LANDING_GEAR] = _landing_gear;
|
||||
actuators.timestamp_sample = angular_velocity.timestamp_sample;
|
||||
|
||||
if (!_vehicle_status.is_vtol) {
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include <uORB/topics/actuator_controls_status.h>
|
||||
#include <uORB/topics/battery_status.h>
|
||||
#include <uORB/topics/control_allocator_status.h>
|
||||
#include <uORB/topics/landing_gear.h>
|
||||
#include <uORB/topics/manual_control_setpoint.h>
|
||||
#include <uORB/topics/parameter_update.h>
|
||||
#include <uORB/topics/rate_ctrl_status.h>
|
||||
@@ -98,7 +97,6 @@ private:
|
||||
|
||||
uORB::Subscription _battery_status_sub{ORB_ID(battery_status)};
|
||||
uORB::Subscription _control_allocator_status_sub{ORB_ID(control_allocator_status)};
|
||||
uORB::Subscription _landing_gear_sub{ORB_ID(landing_gear)};
|
||||
uORB::Subscription _manual_control_setpoint_sub{ORB_ID(manual_control_setpoint)};
|
||||
uORB::Subscription _vehicle_control_mode_sub{ORB_ID(vehicle_control_mode)};
|
||||
uORB::Subscription _vehicle_land_detected_sub{ORB_ID(vehicle_land_detected)};
|
||||
@@ -116,8 +114,6 @@ private:
|
||||
uORB::Publication<vehicle_thrust_setpoint_s> _vehicle_thrust_setpoint_pub{ORB_ID(vehicle_thrust_setpoint)};
|
||||
uORB::Publication<vehicle_torque_setpoint_s> _vehicle_torque_setpoint_pub{ORB_ID(vehicle_torque_setpoint)};
|
||||
|
||||
orb_advert_t _mavlink_log_pub{nullptr};
|
||||
|
||||
vehicle_control_mode_s _vehicle_control_mode{};
|
||||
vehicle_status_s _vehicle_status{};
|
||||
|
||||
@@ -138,8 +134,6 @@ private:
|
||||
float _energy_integration_time{0.0f};
|
||||
float _control_energy[4] {};
|
||||
|
||||
int8_t _landing_gear{landing_gear_s::GEAR_DOWN};
|
||||
|
||||
DEFINE_PARAMETERS(
|
||||
(ParamFloat<px4::params::MC_ROLLRATE_P>) _param_mc_rollrate_p,
|
||||
(ParamFloat<px4::params::MC_ROLLRATE_I>) _param_mc_rollrate_i,
|
||||
|
||||
Reference in New Issue
Block a user