forked from Archive/PX4-Autopilot
Set up landing gear logic for tiltrotor and tailsitter VTOL. Gear is set down when in hover mode, esle gear is set up.
This commit is contained in:
parent
d7de67844f
commit
e080fab8f6
|
@ -42,6 +42,8 @@
|
|||
#include "tailsitter.h"
|
||||
#include "vtol_att_control_main.h"
|
||||
|
||||
#include <uORB/topics/landing_gear.h>
|
||||
|
||||
#define PITCH_TRANSITION_FRONT_P1 -1.1f // pitch angle to switch to TRANSITION_P2
|
||||
#define PITCH_TRANSITION_BACK -0.25f // pitch angle to switch to MC
|
||||
|
||||
|
@ -361,6 +363,14 @@ void Tailsitter::fill_actuator_outputs()
|
|||
_thrust_setpoint_0->xyz[2] = -mc_in[actuator_controls_s::INDEX_THROTTLE];
|
||||
}
|
||||
|
||||
// Landing Gear
|
||||
if (_vtol_schedule.flight_mode == vtol_mode::MC_MODE) {
|
||||
mc_out[actuator_controls_s::INDEX_LANDING_GEAR] = landing_gear_s::GEAR_DOWN;
|
||||
|
||||
} else {
|
||||
mc_out[actuator_controls_s::INDEX_LANDING_GEAR] = landing_gear_s::GEAR_UP;
|
||||
}
|
||||
|
||||
if (_params->elevons_mc_lock && _vtol_schedule.flight_mode == vtol_mode::MC_MODE) {
|
||||
fw_out[actuator_controls_s::INDEX_ROLL] = 0;
|
||||
fw_out[actuator_controls_s::INDEX_PITCH] = 0;
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "tiltrotor.h"
|
||||
#include "vtol_att_control_main.h"
|
||||
|
||||
#include <uORB/topics/landing_gear.h>
|
||||
|
||||
using namespace matrix;
|
||||
using namespace time_literals;
|
||||
|
||||
|
@ -520,6 +522,14 @@ void Tiltrotor::fill_actuator_outputs()
|
|||
_thrust_setpoint_0->xyz[0] = -_thrust_setpoint_0->xyz[2] * sinf(_tilt_control * M_PI_2_F);
|
||||
}
|
||||
|
||||
// Landing gear
|
||||
if (_vtol_schedule.flight_mode == vtol_mode::MC_MODE) {
|
||||
mc_out[actuator_controls_s::INDEX_LANDING_GEAR] = landing_gear_s::GEAR_DOWN;
|
||||
|
||||
} else {
|
||||
mc_out[actuator_controls_s::INDEX_LANDING_GEAR] = landing_gear_s::GEAR_UP;
|
||||
}
|
||||
|
||||
// Fixed wing output
|
||||
fw_out[4] = _tilt_control;
|
||||
|
||||
|
|
Loading…
Reference in New Issue