Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commander: Add prearm check for flight termination #19419

Merged
merged 1 commit into from
Apr 25, 2022

Conversation

julianoes
Copy link
Contributor

This adds a pre-arm check that prevents arming after a flight termination. This probably requires some discussion as it is related to the ongoing discussion in #19198.

@julianoes julianoes requested review from dagar and MaEtUgR March 29, 2022 22:23
msg/vehicle_status_flags.msg Outdated Show resolved Hide resolved
@dagar
Copy link
Member

dagar commented Mar 30, 2022

This solution seems fine, although another idea is that this could probably be done directly in arming_state_transition() with the actuator_armed flags in place and entirely avoid having to update vehicle_status_flags.

armed.lockdown = true;
status_flags.system_sensors_initialized = true;
/* recover from a prearm fail */
if (status.arming_state == vehicle_status_s::ARMING_STATE_STANDBY_ERROR) {
status.arming_state = vehicle_status_s::ARMING_STATE_STANDBY;
}
// HIL can always go to standby
if (new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY) {
valid_transition = true;
}
}
if (!hil_enabled &&
(new_arming_state == vehicle_status_s::ARMING_STATE_STANDBY) &&
(status.arming_state != vehicle_status_s::ARMING_STATE_STANDBY_ERROR)) {
// Sensors need to be initialized for STANDBY state, except for HIL
if (!status_flags.system_sensors_initialized) {
feedback_provided = true;
valid_transition = false;
}
}
// Finish up the state transition
if (valid_transition) {
bool was_armed = armed.armed;
armed.armed = (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED);
armed.ready_to_arm = (new_arming_state == vehicle_status_s::ARMING_STATE_ARMED)

@dagar dagar merged commit 45dff7f into master Apr 25, 2022
@dagar dagar deleted the pr-termination-prearm-check branch April 25, 2022 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants