aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander
diff options
context:
space:
mode:
authorJulian Oes <julian@oes.ch>2014-06-27 11:02:47 +0200
committerJulian Oes <julian@oes.ch>2014-06-27 11:02:47 +0200
commit19fad94a34da757002fe8d608c125a3afa57e091 (patch)
tree0f6b07affbef58be0566bdcbe5bc682eaa4b9201 /src/modules/commander
parent7f41ec52f15191f7a0bbc0ec32301c3135184840 (diff)
parent1bae18377a444279f91b75281ffde5da70cc6086 (diff)
downloadpx4-firmware-19fad94a34da757002fe8d608c125a3afa57e091.tar.gz
px4-firmware-19fad94a34da757002fe8d608c125a3afa57e091.tar.bz2
px4-firmware-19fad94a34da757002fe8d608c125a3afa57e091.zip
Merge branch 'navigator_rewrite' into navigator_rewrite_estimator
Diffstat (limited to 'src/modules/commander')
-rw-r--r--src/modules/commander/commander.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index df7a4c886..0163ee4fb 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -1612,10 +1612,10 @@ set_main_state_rc(struct vehicle_status_s *status, struct manual_control_setpoin
break; // changed successfully or already in this state
}
- // else fallback to ALTCTL
print_reject_mode(status, "POSCTL");
}
+ // fallback to ALTCTL
res = main_state_transition(status, MAIN_STATE_ALTCTL);
if (res != TRANSITION_DENIED) {
@@ -1626,7 +1626,7 @@ set_main_state_rc(struct vehicle_status_s *status, struct manual_control_setpoin
print_reject_mode(status, "ALTCTL");
}
- // else fallback to MANUAL
+ // fallback to MANUAL
res = main_state_transition(status, MAIN_STATE_MANUAL);
// TRANSITION_DENIED is not possible here
break;
@@ -1638,28 +1638,50 @@ set_main_state_rc(struct vehicle_status_s *status, struct manual_control_setpoin
if (res != TRANSITION_DENIED) {
break; // changed successfully or already in this state
}
+
+ print_reject_mode(status, "AUTO_RTL");
+
+ // fallback to LOITER if home position not set
+ res = main_state_transition(status, MAIN_STATE_AUTO_LOITER);
+
+ if (res != TRANSITION_DENIED) {
+ break; // changed successfully or already in this state
+ }
+
} else if (sp_man->loiter_switch == SWITCH_POS_ON) {
res = main_state_transition(status, MAIN_STATE_AUTO_LOITER);
if (res != TRANSITION_DENIED) {
break; // changed successfully or already in this state
}
+
+ print_reject_mode(status, "AUTO_LOITER");
+
} else {
res = main_state_transition(status, MAIN_STATE_AUTO_MISSION);
if (res != TRANSITION_DENIED) {
break; // changed successfully or already in this state
}
+
+ print_reject_mode(status, "AUTO_MISSION");
}
- // else fallback to ALTCTL (POSCTL likely will not work too)
+ // fallback to POSCTL
+ res = main_state_transition(status, MAIN_STATE_POSCTL);
+
+ if (res != TRANSITION_DENIED) {
+ break; // changed successfully or already in this state
+ }
+
+ // fallback to ALTCTL
res = main_state_transition(status, MAIN_STATE_ALTCTL);
if (res != TRANSITION_DENIED) {
break; // changed successfully or already in this state
}
- // else fallback to MANUAL
+ // fallback to MANUAL
res = main_state_transition(status, MAIN_STATE_MANUAL);
// TRANSITION_DENIED is not possible here
break;