mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 06:03:35 +08:00
Publish manual_sas_mode immediately, SAS modes switch order changed to more safe
This commit is contained in:
committed by
Anton Babushkin
parent
8191130bbc
commit
d3eb86d0ea
@@ -1389,6 +1389,7 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
uint64_t start_time = hrt_absolute_time();
|
uint64_t start_time = hrt_absolute_time();
|
||||||
uint64_t failsave_ll_start_time = 0;
|
uint64_t failsave_ll_start_time = 0;
|
||||||
|
|
||||||
|
enum VEHICLE_MANUAL_SAS_MODE manual_sas_mode;
|
||||||
bool state_changed = true;
|
bool state_changed = true;
|
||||||
bool param_init_forced = true;
|
bool param_init_forced = true;
|
||||||
|
|
||||||
@@ -1828,8 +1829,9 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
|
|
||||||
} else if (sp_man.manual_sas_switch < -STICK_ON_OFF_LIMIT) {
|
} else if (sp_man.manual_sas_switch < -STICK_ON_OFF_LIMIT) {
|
||||||
|
|
||||||
/* bottom stick position, set altitude hold */
|
/* bottom stick position, set default */
|
||||||
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ALTITUDE;
|
/* this MUST be mapped to extremal position to switch easy in case of emergency */
|
||||||
|
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ROLL_PITCH_ABS_YAW_ABS;
|
||||||
|
|
||||||
} else if (sp_man.manual_sas_switch > STICK_ON_OFF_LIMIT) {
|
} else if (sp_man.manual_sas_switch > STICK_ON_OFF_LIMIT) {
|
||||||
|
|
||||||
@@ -1837,8 +1839,14 @@ int commander_thread_main(int argc, char *argv[])
|
|||||||
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_SIMPLE;
|
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_SIMPLE;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* center stick position, set default */
|
/* center stick position, set altitude hold */
|
||||||
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ROLL_PITCH_ABS_YAW_ABS;
|
current_status.manual_sas_mode = VEHICLE_MANUAL_SAS_MODE_ALTITUDE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (current_status.manual_sas_mode != manual_sas_mode) {
|
||||||
|
/* publish SAS mode changes immediately */
|
||||||
|
manual_sas_mode = current_status.manual_sas_mode;
|
||||||
|
state_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user