mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 07:57:36 +08:00
Override is now really disabled for multirotors, also I don't think the parameter got ever read by the commander but I might be wrong
This commit is contained in:
@@ -1293,6 +1293,8 @@ int commander_thread_main(int argc, char *argv[])
|
||||
uint64_t failsave_ll_start_time = 0;
|
||||
|
||||
bool state_changed = true;
|
||||
bool param_init_forced = true;
|
||||
|
||||
|
||||
while (!thread_should_exit) {
|
||||
|
||||
@@ -1323,10 +1325,10 @@ int commander_thread_main(int argc, char *argv[])
|
||||
/* handle it */
|
||||
handle_command(stat_pub, ¤t_status, &cmd);
|
||||
}
|
||||
|
||||
/* update parameters */
|
||||
orb_check(param_changed_sub, &new_data);
|
||||
if (new_data) {
|
||||
if (new_data || param_init_forced) {
|
||||
param_init_forced = false;
|
||||
/* parameters changed */
|
||||
orb_copy(ORB_ID(parameter_update), param_changed_sub, ¶m_changed);
|
||||
|
||||
@@ -1335,7 +1337,6 @@ int commander_thread_main(int argc, char *argv[])
|
||||
if (param_get(_param_sys_type, &(current_status.system_type)) != OK) {
|
||||
warnx("failed setting new system type");
|
||||
}
|
||||
|
||||
/* disable manual override for all systems that rely on electronic stabilization */
|
||||
if (current_status.system_type == MAV_TYPE_QUADROTOR ||
|
||||
current_status.system_type == MAV_TYPE_HEXAROTOR ||
|
||||
|
||||
+32
-19
@@ -84,32 +84,45 @@ mixer_tick(void)
|
||||
int i;
|
||||
bool should_arm;
|
||||
|
||||
/* check that we are receiving fresh data from the FMU */
|
||||
if ((hrt_absolute_time() - system_state.fmu_data_received_time) > FMU_INPUT_DROP_LIMIT_US) {
|
||||
/* too many frames without FMU input, time to go to failsafe */
|
||||
system_state.mixer_manual_override = true;
|
||||
system_state.mixer_fmu_available = false;
|
||||
lib_lowprintf("\nRX timeout\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Decide which set of inputs we're using.
|
||||
*/
|
||||
if (!system_state.mixer_manual_override && system_state.mixer_fmu_available) {
|
||||
/* we have recent control data from the FMU */
|
||||
control_count = PX4IO_OUTPUT_CHANNELS;
|
||||
control_values = &system_state.fmu_channel_data[0];
|
||||
/* this is for planes, where manual override makes sense */
|
||||
if(system_state.manual_override_ok) {
|
||||
/* if everything is ok */
|
||||
if (!system_state.mixer_manual_override && system_state.mixer_fmu_available) {
|
||||
/* we have recent control data from the FMU */
|
||||
control_count = PX4IO_OUTPUT_CHANNELS;
|
||||
control_values = &system_state.fmu_channel_data[0];
|
||||
/* when override is on or the fmu is not available */
|
||||
} else if (system_state.rc_channels > 0) {
|
||||
control_count = system_state.rc_channels;
|
||||
control_values = &system_state.rc_channel_data[0];
|
||||
} else {
|
||||
/* we have no control input (no FMU, no RC) */
|
||||
|
||||
/* check that we are receiving fresh data from the FMU */
|
||||
if ((hrt_absolute_time() - system_state.fmu_data_received_time) > FMU_INPUT_DROP_LIMIT_US) {
|
||||
|
||||
/* too many frames without FMU input, time to go to failsafe */
|
||||
system_state.mixer_manual_override = true;
|
||||
system_state.mixer_fmu_available = false;
|
||||
lib_lowprintf("\nRX timeout\n");
|
||||
// XXX builtin failsafe would activate here
|
||||
control_count = 0;
|
||||
}
|
||||
|
||||
} else if (system_state.rc_channels > 0 && system_state.manual_override_ok) {
|
||||
/* we have control data from an R/C input */
|
||||
control_count = system_state.rc_channels;
|
||||
control_values = &system_state.rc_channel_data[0];
|
||||
/* this is for multicopters, etc. where manual override does not make sense */
|
||||
} else {
|
||||
/* we have no control input (no FMU, no RC) */
|
||||
|
||||
// XXX builtin failsafe would activate here
|
||||
control_count = 0;
|
||||
/* if the fmu is available whe are good */
|
||||
if(system_state.mixer_fmu_available) {
|
||||
control_count = PX4IO_OUTPUT_CHANNELS;
|
||||
control_values = &system_state.fmu_channel_data[0];
|
||||
/* we better shut everything off */
|
||||
} else {
|
||||
control_count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user