mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 13:13:33 +08:00
delete RATTITUDE flight mode
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2013-2019 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2013-2021 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -321,9 +321,6 @@ int Commander::custom_command(int argc, char *argv[])
|
||||
} else if (!strcmp(argv[1], "stabilized")) {
|
||||
send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_SET_MODE, 1, PX4_CUSTOM_MAIN_MODE_STABILIZED);
|
||||
|
||||
} else if (!strcmp(argv[1], "rattitude")) {
|
||||
send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_SET_MODE, 1, PX4_CUSTOM_MAIN_MODE_RATTITUDE);
|
||||
|
||||
} else if (!strcmp(argv[1], "auto:takeoff")) {
|
||||
send_vehicle_command(vehicle_command_s::VEHICLE_CMD_DO_SET_MODE, 1, PX4_CUSTOM_MAIN_MODE_AUTO,
|
||||
PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF);
|
||||
@@ -664,10 +661,6 @@ Commander::handle_command(const vehicle_command_s &cmd)
|
||||
/* ACRO */
|
||||
main_ret = main_state_transition(_status, commander_state_s::MAIN_STATE_ACRO, _status_flags, &_internal_state);
|
||||
|
||||
} else if (custom_main_mode == PX4_CUSTOM_MAIN_MODE_RATTITUDE) {
|
||||
/* RATTITUDE */
|
||||
main_ret = main_state_transition(_status, commander_state_s::MAIN_STATE_RATTITUDE, _status_flags, &_internal_state);
|
||||
|
||||
} else if (custom_main_mode == PX4_CUSTOM_MAIN_MODE_STABILIZED) {
|
||||
/* STABILIZED */
|
||||
main_ret = main_state_transition(_status, commander_state_s::MAIN_STATE_STAB, _status_flags, &_internal_state);
|
||||
@@ -2790,7 +2783,6 @@ Commander::set_main_state_rc()
|
||||
|| (_last_manual_control_switches.return_switch != _manual_control_switches.return_switch)
|
||||
|| (_last_manual_control_switches.mode_switch != _manual_control_switches.mode_switch)
|
||||
|| (_last_manual_control_switches.acro_switch != _manual_control_switches.acro_switch)
|
||||
|| (_last_manual_control_switches.rattitude_switch != _manual_control_switches.rattitude_switch)
|
||||
|| (_last_manual_control_switches.posctl_switch != _manual_control_switches.posctl_switch)
|
||||
|| (_last_manual_control_switches.loiter_switch != _manual_control_switches.loiter_switch)
|
||||
|| (_last_manual_control_switches.mode_slot != _manual_control_switches.mode_slot)
|
||||
@@ -3044,16 +3036,6 @@ Commander::set_main_state_rc()
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_MANUAL, _status_flags, &_internal_state);
|
||||
}
|
||||
|
||||
} else if (_manual_control_switches.rattitude_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
/* Similar to acro transitions for multirotors. FW aircraft don't need a
|
||||
* rattitude mode.*/
|
||||
if (_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_RATTITUDE, _status_flags, &_internal_state);
|
||||
|
||||
} else {
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_STAB, _status_flags, &_internal_state);
|
||||
}
|
||||
|
||||
} else {
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_MANUAL, _status_flags, &_internal_state);
|
||||
}
|
||||
@@ -3069,9 +3051,6 @@ Commander::set_main_state_rc()
|
||||
} else if (_manual_control_switches.acro_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_ACRO, _status_flags, &_internal_state);
|
||||
|
||||
} else if (_manual_control_switches.rattitude_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_RATTITUDE, _status_flags, &_internal_state);
|
||||
|
||||
} else if (_manual_control_switches.stab_switch == manual_control_switches_s::SWITCH_POS_ON) {
|
||||
res = main_state_transition(_status, commander_state_s::MAIN_STATE_STAB, _status_flags, &_internal_state);
|
||||
|
||||
@@ -3251,13 +3230,6 @@ Commander::update_control_mode()
|
||||
_vehicle_control_mode.flag_control_attitude_enabled = true;
|
||||
break;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_RATTITUDE:
|
||||
_vehicle_control_mode.flag_control_manual_enabled = true;
|
||||
_vehicle_control_mode.flag_control_rates_enabled = true;
|
||||
_vehicle_control_mode.flag_control_attitude_enabled = true;
|
||||
_vehicle_control_mode.flag_control_rattitude_enabled = true;
|
||||
break;
|
||||
|
||||
case vehicle_status_s::NAVIGATION_STATE_ALTCTL:
|
||||
_vehicle_control_mode.flag_control_manual_enabled = true;
|
||||
_vehicle_control_mode.flag_control_rates_enabled = true;
|
||||
@@ -3360,7 +3332,6 @@ Commander::update_control_mode()
|
||||
_vehicle_control_mode.flag_control_auto_enabled = false;
|
||||
_vehicle_control_mode.flag_control_rates_enabled = true;
|
||||
_vehicle_control_mode.flag_control_attitude_enabled = true;
|
||||
_vehicle_control_mode.flag_control_rattitude_enabled = false;
|
||||
_vehicle_control_mode.flag_control_altitude_enabled = true;
|
||||
_vehicle_control_mode.flag_control_climb_rate_enabled = true;
|
||||
_vehicle_control_mode.flag_control_position_enabled = !_status.in_transition_mode;
|
||||
@@ -4059,7 +4030,7 @@ The commander module contains the state machine for mode switching and failsafe
|
||||
PRINT_MODULE_USAGE_COMMAND("land");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("transition", "VTOL transition");
|
||||
PRINT_MODULE_USAGE_COMMAND_DESCR("mode", "Change flight mode");
|
||||
PRINT_MODULE_USAGE_ARG("manual|acro|offboard|stabilized|rattitude|altctl|posctl|auto:mission|auto:loiter|auto:rtl|auto:takeoff|auto:land|auto:precland",
|
||||
PRINT_MODULE_USAGE_ARG("manual|acro|offboard|stabilized|altctl|posctl|auto:mission|auto:loiter|auto:rtl|auto:takeoff|auto:land|auto:precland",
|
||||
"Flight mode", false);
|
||||
PRINT_MODULE_USAGE_COMMAND("lockdown");
|
||||
PRINT_MODULE_USAGE_ARG("off", "Turn lockdown off", true);
|
||||
|
||||
@@ -405,7 +405,6 @@ PARAM_DEFINE_INT32(COM_OBL_RC_ACT, 0);
|
||||
* @value 6 Acro
|
||||
* @value 7 Offboard
|
||||
* @value 8 Stabilized
|
||||
* @value 9 Rattitude
|
||||
* @value 12 Follow Me
|
||||
* @group Commander
|
||||
*/
|
||||
@@ -429,7 +428,6 @@ PARAM_DEFINE_INT32(COM_FLTMODE1, -1);
|
||||
* @value 6 Acro
|
||||
* @value 7 Offboard
|
||||
* @value 8 Stabilized
|
||||
* @value 9 Rattitude
|
||||
* @value 12 Follow Me
|
||||
* @group Commander
|
||||
*/
|
||||
@@ -453,7 +451,6 @@ PARAM_DEFINE_INT32(COM_FLTMODE2, -1);
|
||||
* @value 6 Acro
|
||||
* @value 7 Offboard
|
||||
* @value 8 Stabilized
|
||||
* @value 9 Rattitude
|
||||
* @value 12 Follow Me
|
||||
* @group Commander
|
||||
*/
|
||||
@@ -477,7 +474,6 @@ PARAM_DEFINE_INT32(COM_FLTMODE3, -1);
|
||||
* @value 6 Acro
|
||||
* @value 7 Offboard
|
||||
* @value 8 Stabilized
|
||||
* @value 9 Rattitude
|
||||
* @value 12 Follow Me
|
||||
* @group Commander
|
||||
*/
|
||||
@@ -501,7 +497,6 @@ PARAM_DEFINE_INT32(COM_FLTMODE4, -1);
|
||||
* @value 6 Acro
|
||||
* @value 7 Offboard
|
||||
* @value 8 Stabilized
|
||||
* @value 9 Rattitude
|
||||
* @value 12 Follow Me
|
||||
* @group Commander
|
||||
*/
|
||||
@@ -525,7 +520,6 @@ PARAM_DEFINE_INT32(COM_FLTMODE5, -1);
|
||||
* @value 6 Acro
|
||||
* @value 7 Offboard
|
||||
* @value 8 Stabilized
|
||||
* @value 9 Rattitude
|
||||
* @value 12 Follow Me
|
||||
* @group Commander
|
||||
*/
|
||||
@@ -966,7 +960,7 @@ PARAM_DEFINE_INT32(COM_POWER_COUNT, 1);
|
||||
*
|
||||
* A non-zero, positive value specifies the timeframe in seconds within failure detector is allowed to put the vehicle into
|
||||
* a lockdown state if attitude exceeds the limits defined in FD_FAIL_P and FD_FAIL_R.
|
||||
* The check is not executed for flight modes that do support acrobatic maneuvers, e.g: Acro (MC/FW), Rattitude and Manual (FW).
|
||||
* The check is not executed for flight modes that do support acrobatic maneuvers, e.g: Acro (MC/FW) and Manual (FW).
|
||||
* A zero or negative value means that the check is disabled.
|
||||
*
|
||||
* @group Commander
|
||||
|
||||
@@ -76,13 +76,11 @@ bool FailureDetector::isAttitudeStabilized(const vehicle_status_s &vehicle_statu
|
||||
const uint8_t nav_state = vehicle_status.nav_state;
|
||||
|
||||
if (vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
|
||||
attitude_is_stabilized = nav_state != vehicle_status_s::NAVIGATION_STATE_ACRO &&
|
||||
nav_state != vehicle_status_s::NAVIGATION_STATE_RATTITUDE;
|
||||
attitude_is_stabilized = nav_state != vehicle_status_s::NAVIGATION_STATE_ACRO;
|
||||
|
||||
} else if (vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING) {
|
||||
attitude_is_stabilized = nav_state != vehicle_status_s::NAVIGATION_STATE_MANUAL &&
|
||||
nav_state != vehicle_status_s::NAVIGATION_STATE_ACRO &&
|
||||
nav_state != vehicle_status_s::NAVIGATION_STATE_RATTITUDE;
|
||||
nav_state != vehicle_status_s::NAVIGATION_STATE_ACRO;
|
||||
}
|
||||
|
||||
return attitude_is_stabilized;
|
||||
|
||||
@@ -50,7 +50,7 @@ enum PX4_CUSTOM_MAIN_MODE {
|
||||
PX4_CUSTOM_MAIN_MODE_ACRO,
|
||||
PX4_CUSTOM_MAIN_MODE_OFFBOARD,
|
||||
PX4_CUSTOM_MAIN_MODE_STABILIZED,
|
||||
PX4_CUSTOM_MAIN_MODE_RATTITUDE,
|
||||
PX4_CUSTOM_MAIN_MODE_RATTITUDE_LEGACY,
|
||||
PX4_CUSTOM_MAIN_MODE_SIMPLE /* unused, but reserved for future use */
|
||||
};
|
||||
|
||||
|
||||
@@ -270,7 +270,6 @@ main_state_transition(const vehicle_status_s &status, const main_state_t new_mai
|
||||
case commander_state_s::MAIN_STATE_MANUAL:
|
||||
case commander_state_s::MAIN_STATE_STAB:
|
||||
case commander_state_s::MAIN_STATE_ACRO:
|
||||
case commander_state_s::MAIN_STATE_RATTITUDE:
|
||||
ret = TRANSITION_CHANGED;
|
||||
break;
|
||||
|
||||
@@ -431,7 +430,6 @@ bool set_nav_state(vehicle_status_s *status, actuator_armed_s *armed, commander_
|
||||
switch (internal_state->main_state) {
|
||||
case commander_state_s::MAIN_STATE_ACRO:
|
||||
case commander_state_s::MAIN_STATE_MANUAL:
|
||||
case commander_state_s::MAIN_STATE_RATTITUDE:
|
||||
case commander_state_s::MAIN_STATE_STAB:
|
||||
case commander_state_s::MAIN_STATE_ALTCTL:
|
||||
|
||||
@@ -451,10 +449,6 @@ bool set_nav_state(vehicle_status_s *status, actuator_armed_s *armed, commander_
|
||||
status->nav_state = vehicle_status_s::NAVIGATION_STATE_MANUAL;
|
||||
break;
|
||||
|
||||
case commander_state_s::MAIN_STATE_RATTITUDE:
|
||||
status->nav_state = vehicle_status_s::NAVIGATION_STATE_RATTITUDE;
|
||||
break;
|
||||
|
||||
case commander_state_s::MAIN_STATE_STAB:
|
||||
status->nav_state = vehicle_status_s::NAVIGATION_STATE_STAB;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user