mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-06 15:51:36 +08:00
update Quadchute trigger from mavlink PR 1569
This commit is contained in:
@@ -4,7 +4,6 @@ uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_FW = 1
|
|||||||
uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2
|
uint8 VEHICLE_VTOL_STATE_TRANSITION_TO_MC = 2
|
||||||
uint8 VEHICLE_VTOL_STATE_MC = 3
|
uint8 VEHICLE_VTOL_STATE_MC = 3
|
||||||
uint8 VEHICLE_VTOL_STATE_FW = 4
|
uint8 VEHICLE_VTOL_STATE_FW = 4
|
||||||
uint8 VEHICLE_VTOL_STATE_QC = 5
|
|
||||||
|
|
||||||
uint64 timestamp # time since system start (microseconds)
|
uint64 timestamp # time since system start (microseconds)
|
||||||
|
|
||||||
|
|||||||
@@ -160,6 +160,7 @@ void VtolAttitudeControl::vehicle_cmd_poll()
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
_transition_command = int(vehicle_command.param1 + 0.5f);
|
_transition_command = int(vehicle_command.param1 + 0.5f);
|
||||||
|
_immediate_transition = int(vehicle_command.param2 + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vehicle_command.from_external) {
|
if (vehicle_command.from_external) {
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ public:
|
|||||||
bool is_fixed_wing_requested();
|
bool is_fixed_wing_requested();
|
||||||
void quadchute(const char *reason);
|
void quadchute(const char *reason);
|
||||||
int get_transition_command() {return _transition_command;}
|
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_fw_in() {return &_actuators_fw_in;}
|
||||||
struct actuator_controls_s *get_actuators_mc_in() {return &_actuators_mc_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
|
* for fixed wings we want to have an idle speed of zero since we do not want
|
||||||
* to waste energy when gliding. */
|
* to waste energy when gliding. */
|
||||||
int _transition_command{vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC};
|
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
|
VtolType *_vtol_type{nullptr}; // base class for different vtol types
|
||||||
|
|
||||||
|
|||||||
@@ -235,16 +235,16 @@ bool VtolType::can_transition_on_ground()
|
|||||||
|
|
||||||
void VtolType::check_quadchute_condition()
|
void VtolType::check_quadchute_condition()
|
||||||
{
|
{
|
||||||
if (_attc->get_transition_command() == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_QC && !_quadchute_command_treated) {
|
if (_attc->get_transition_command() == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_MC && _attc->get_immediate_transition()
|
||||||
_attc->quadchute("QuadChute by command");
|
&& !_quadchute_command_treated) {
|
||||||
|
_attc->quadchute("QuadChute by external command");
|
||||||
_quadchute_command_treated = true;
|
_quadchute_command_treated = true;
|
||||||
|
_attc->reset_immediate_transition();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_quadchute_command_treated = false;
|
_quadchute_command_treated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!_tecs_running) {
|
if (!_tecs_running) {
|
||||||
// reset the filtered height rate and heigh rate setpoint if TECS is not running
|
// reset the filtered height rate and heigh rate setpoint if TECS is not running
|
||||||
_ra_hrate = 0.0f;
|
_ra_hrate = 0.0f;
|
||||||
|
|||||||
@@ -250,7 +250,6 @@ protected:
|
|||||||
bool _quadchute_command_treated = 0;
|
bool _quadchute_command_treated = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets mc motor minimum pwm to VT_IDLE_PWM_MC which ensures
|
* @brief Sets mc motor minimum pwm to VT_IDLE_PWM_MC which ensures
|
||||||
* that they are spinning in mc mode.
|
* that they are spinning in mc mode.
|
||||||
|
|||||||
Reference in New Issue
Block a user