|
|
@ -984,18 +984,18 @@ bool handle_command(struct vehicle_status_s *status_local, const struct safety_s |
|
|
|
|
|
|
|
|
|
|
|
if (res == TRANSITION_DENIED) { |
|
|
|
if (res == TRANSITION_DENIED) { |
|
|
|
print_reject_mode(status_local, "OFFBOARD"); |
|
|
|
print_reject_mode(status_local, "OFFBOARD"); |
|
|
|
status_local->offboard_control_set_by_command = false; |
|
|
|
status_flags.offboard_control_set_by_command = false; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/* Set flag that offboard was set via command, main state is not overridden by rc */ |
|
|
|
/* Set flag that offboard was set via command, main state is not overridden by rc */ |
|
|
|
status_local->offboard_control_set_by_command = true; |
|
|
|
status_flags.offboard_control_set_by_command = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
/* If the mavlink command is used to enable or disable offboard control:
|
|
|
|
/* If the mavlink command is used to enable or disable offboard control:
|
|
|
|
* switch back to previous mode when disabling */ |
|
|
|
* switch back to previous mode when disabling */ |
|
|
|
res = main_state_transition(status_local, main_state_pre_offboard, main_state_prev, &status_flags); |
|
|
|
res = main_state_transition(status_local, main_state_pre_offboard, main_state_prev, &status_flags); |
|
|
|
status_local->offboard_control_set_by_command = false; |
|
|
|
status_flags.offboard_control_set_by_command = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1237,12 +1237,12 @@ int commander_thread_main(int argc, char *argv[]) |
|
|
|
status.failsafe = false; |
|
|
|
status.failsafe = false; |
|
|
|
|
|
|
|
|
|
|
|
/* neither manual nor offboard control commands have been received */ |
|
|
|
/* neither manual nor offboard control commands have been received */ |
|
|
|
status.offboard_control_signal_found_once = false; |
|
|
|
status_flags.offboard_control_signal_found_once = false; |
|
|
|
status.rc_signal_found_once = false; |
|
|
|
status.rc_signal_found_once = false; |
|
|
|
|
|
|
|
|
|
|
|
/* mark all signals lost as long as they haven't been found */ |
|
|
|
/* mark all signals lost as long as they haven't been found */ |
|
|
|
status.rc_signal_lost = true; |
|
|
|
status.rc_signal_lost = true; |
|
|
|
status.offboard_control_signal_lost = true; |
|
|
|
status_flags.offboard_control_signal_lost = true; |
|
|
|
status.data_link_lost = true; |
|
|
|
status.data_link_lost = true; |
|
|
|
|
|
|
|
|
|
|
|
status_flags.condition_system_prearm_error_reported = false; |
|
|
|
status_flags.condition_system_prearm_error_reported = false; |
|
|
@ -1625,14 +1625,14 @@ int commander_thread_main(int argc, char *argv[]) |
|
|
|
|
|
|
|
|
|
|
|
if (offboard_control_mode.timestamp != 0 && |
|
|
|
if (offboard_control_mode.timestamp != 0 && |
|
|
|
offboard_control_mode.timestamp + OFFBOARD_TIMEOUT > hrt_absolute_time()) { |
|
|
|
offboard_control_mode.timestamp + OFFBOARD_TIMEOUT > hrt_absolute_time()) { |
|
|
|
if (status.offboard_control_signal_lost) { |
|
|
|
if (status_flags.offboard_control_signal_lost) { |
|
|
|
status.offboard_control_signal_lost = false; |
|
|
|
status_flags.offboard_control_signal_lost = false; |
|
|
|
status_changed = true; |
|
|
|
status_changed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!status.offboard_control_signal_lost) { |
|
|
|
if (!status_flags.offboard_control_signal_lost) { |
|
|
|
status.offboard_control_signal_lost = true; |
|
|
|
status_flags.offboard_control_signal_lost = true; |
|
|
|
status_changed = true; |
|
|
|
status_changed = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -2883,7 +2883,7 @@ set_main_state_rc(struct vehicle_status_s *status_local, struct manual_control_s |
|
|
|
// XXX this should not be necessary any more, we should be able to
|
|
|
|
// XXX this should not be necessary any more, we should be able to
|
|
|
|
// just delete this and respond to mode switches
|
|
|
|
// just delete this and respond to mode switches
|
|
|
|
/* if offboard is set already by a mavlink command, abort */ |
|
|
|
/* if offboard is set already by a mavlink command, abort */ |
|
|
|
if (status.offboard_control_set_by_command) { |
|
|
|
if (status_flags.offboard_control_set_by_command) { |
|
|
|
return main_state_transition(status_local,vehicle_status_s::MAIN_STATE_OFFBOARD, main_state_prev, &status_flags); |
|
|
|
return main_state_transition(status_local,vehicle_status_s::MAIN_STATE_OFFBOARD, main_state_prev, &status_flags); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|