update Quadchute trigger from mavlink PR 1569

This commit is contained in:
Thomas 2021-04-09 17:50:09 +02:00 committed by Roman Bapst
parent bf9758247b
commit ab10e68a40
5 changed files with 8 additions and 6 deletions

View File

@ -4,7 +4,6 @@ uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_FW = 1
uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2
uint8 VEHICLE_VTOL_STATE_MC = 3
uint8 VEHICLE_VTOL_STATE_FW = 4
uint8 VEHICLE_VTOL_STATE_QC = 5
uint64 timestamp # time since system start (microseconds)

View File

@ -160,6 +160,7 @@ void VtolAttitudeControl::vehicle_cmd_poll()
} else {
_transition_command = int(vehicle_command.param1 + 0.5f);
_immediate_transition = int(vehicle_command.param2 + 0.5f);
}
if (vehicle_command.from_external) {

View File

@ -109,6 +109,8 @@ public:
bool is_fixed_wing_requested();
void quadchute(const char *reason);
int get_transition_command() {return _transition_command;}
bool get_immediate_transition() {return _immediate_transition;}
void reset_immediate_transition() {_immediate_transition = false;}
struct actuator_controls_s *get_actuators_fw_in() {return &_actuators_fw_in;}
struct actuator_controls_s *get_actuators_mc_in() {return &_actuators_mc_in;}
@ -222,6 +224,7 @@ private:
* for fixed wings we want to have an idle speed of zero since we do not want
* to waste energy when gliding. */
int _transition_command{vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC};
bool _immediate_transition{false};
VtolType *_vtol_type{nullptr}; // base class for different vtol types

View File

@ -235,16 +235,16 @@ bool VtolType::can_transition_on_ground()
void VtolType::check_quadchute_condition()
{
if (_attc->get_transition_command() == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_QC && !_quadchute_command_treated) {
_attc->quadchute("QuadChute by command");
if (_attc->get_transition_command() == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC && _attc->get_immediate_transition()
&& !_quadchute_command_treated) {
_attc->quadchute("QuadChute by external command");
_quadchute_command_treated = true;
_attc->reset_immediate_transition();
} else {
_quadchute_command_treated = false;
}
if (!_tecs_running) {
// reset the filtered height rate and heigh rate setpoint if TECS is not running
_ra_hrate = 0.0f;

View File

@ -250,7 +250,6 @@ protected:
bool _quadchute_command_treated = 0;
/**
* @brief Sets mc motor minimum pwm to VT_IDLE_PWM_MC which ensures
* that they are spinning in mc mode.