Browse Source

VTOL status: Do not force a commander status change

Before the VTOL status would automatically force a commander state update all the time. This saves effort and makes sure the system only updates when it should.
sbg
Lorenz Meier 7 years ago
parent
commit
2167457e2e
  1. 32
      src/modules/commander/commander.cpp

32
src/modules/commander/commander.cpp

@ -2018,15 +2018,33 @@ Commander::run() @@ -2018,15 +2018,33 @@ Commander::run()
/* Make sure that this is only adjusted if vehicle really is of type vtol */
if (is_vtol(&status)) {
status.is_rotary_wing = vtol_status.vtol_in_rw_mode;
status.in_transition_mode = vtol_status.vtol_in_trans_mode;
status.in_transition_to_fw = vtol_status.in_transition_to_fw;
status_flags.vtol_transition_failure = vtol_status.vtol_transition_failsafe;
armed.soft_stop = !status.is_rotary_wing;
}
// Check if there has been any change while updating the flags
if (status.is_rotary_wing != vtol_status.vtol_in_rw_mode) {
status.is_rotary_wing = vtol_status.vtol_in_rw_mode;
status_changed = true;
}
status_changed = true;
if (status.in_transition_mode != vtol_status.vtol_in_trans_mode) {
status.in_transition_mode = vtol_status.vtol_in_trans_mode;
status_changed = true;
}
if (status.in_transition_to_fw != vtol_status.in_transition_to_fw) {
status.in_transition_to_fw = vtol_status.in_transition_to_fw;
status_changed = true;
}
if (status_flags.vtol_transition_failure != vtol_status.vtol_transition_failsafe) {
status_flags.vtol_transition_failure = vtol_status.vtol_transition_failsafe;
status_changed = true;
}
if (armed.soft_stop != !status.is_rotary_wing) {
armed.soft_stop = !status.is_rotary_wing;
status_changed = true;
}
}
}
// Check if quality checking of position accuracy and consistency is to be performed

Loading…
Cancel
Save