diff --git a/src/modules/vtol_att_control/tailsitter.cpp b/src/modules/vtol_att_control/tailsitter.cpp index 9d9db91d2c..d583ab4473 100644 --- a/src/modules/vtol_att_control/tailsitter.cpp +++ b/src/modules/vtol_att_control/tailsitter.cpp @@ -42,6 +42,8 @@ #include "tailsitter.h" #include "vtol_att_control_main.h" +#include + #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; diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp index d4e2046e53..ae4b843fef 100644 --- a/src/modules/vtol_att_control/tiltrotor.cpp +++ b/src/modules/vtol_att_control/tiltrotor.cpp @@ -42,6 +42,8 @@ #include "tiltrotor.h" #include "vtol_att_control_main.h" +#include + 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;