aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Jansen <jnsn.johan@gmail.com>2015-03-17 10:06:02 +0100
committerLorenz Meier <lm@inf.ethz.ch>2015-04-20 09:14:13 +0200
commit7a4ac0ad7fa5a8faad927067c5267b052d5b9cd1 (patch)
tree561856e2375fbd2d79503b5a3e2cf802237e05d5
parenta6c57afabd22a7f683bad07d396c178c59e3dc7c (diff)
downloadpx4-firmware-7a4ac0ad7fa5a8faad927067c5267b052d5b9cd1.tar.gz
px4-firmware-7a4ac0ad7fa5a8faad927067c5267b052d5b9cd1.tar.bz2
px4-firmware-7a4ac0ad7fa5a8faad927067c5267b052d5b9cd1.zip
Commander: Ignore sensor status on in-air restore
-rw-r--r--src/modules/commander/commander.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index 01f084007..e2a143f7f 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -537,13 +537,6 @@ bool handle_command(struct vehicle_status_s *status_local, const struct safety_s
case VEHICLE_CMD_COMPONENT_ARM_DISARM: {
- //Refuse to arm if preflight checks have failed
- if(!status.condition_system_sensors_initialized) {
- mavlink_log_critical(mavlink_fd, "Arming DENIED. Preflight checks have failed.");
- cmd_result = VEHICLE_CMD_RESULT_DENIED;
- break;
- }
-
// Adhere to MAVLink specs, but base on knowledge that these fundamentally encode ints
// for logic state parameters
if (static_cast<int>(cmd->param1 + 0.5f) != 0 && static_cast<int>(cmd->param1 + 0.5f) != 1) {
@@ -557,6 +550,16 @@ bool handle_command(struct vehicle_status_s *status_local, const struct safety_s
if (cmd->source_system == status_local->system_id && cmd->source_component == status_local->component_id) {
status_local->arming_state = vehicle_status_s::ARMING_STATE_IN_AIR_RESTORE;
}
+ else {
+
+ //Refuse to arm if preflight checks have failed
+ if(!status.condition_system_sensors_initialized) {
+ mavlink_log_critical(mavlink_fd, "Arming DENIED. Preflight checks have failed.");
+ cmd_result = VEHICLE_CMD_RESULT_DENIED;
+ break;
+ }
+
+ }
transition_result_t arming_res = arm_disarm(cmd_arms, mavlink_fd, "arm/disarm component command");