aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commander/commander.cpp
diff options
context:
space:
mode:
authorAnton Babushkin <anton.babushkin@me.com>2013-08-19 18:33:04 +0200
committerAnton Babushkin <anton.babushkin@me.com>2013-08-19 18:33:04 +0200
commit449dc78ae69e888d986185f120aa8c6549ef5c2b (patch)
tree9b3de04f5b287c32ec9c7cfe6094ead84ba980d3 /src/modules/commander/commander.cpp
parentf96bb824d4fc6f6d36ddf24e8879d3025af39d70 (diff)
downloadpx4-firmware-449dc78ae69e888d986185f120aa8c6549ef5c2b.tar.gz
px4-firmware-449dc78ae69e888d986185f120aa8c6549ef5c2b.tar.bz2
px4-firmware-449dc78ae69e888d986185f120aa8c6549ef5c2b.zip
commander, multirotor_pos_control, sdlog2: bugfixes
Diffstat (limited to 'src/modules/commander/commander.cpp')
-rw-r--r--src/modules/commander/commander.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index 7d74e0cfe..50acec7e0 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -353,16 +353,21 @@ void handle_command(struct vehicle_status_s *status, const struct safety_s *safe
}
case VEHICLE_CMD_NAV_TAKEOFF: {
- transition_result_t nav_res = navigation_state_transition(status, NAVIGATION_STATE_AUTO_TAKEOFF, control_mode);
+ if (armed->armed) {
+ transition_result_t nav_res = navigation_state_transition(status, NAVIGATION_STATE_AUTO_TAKEOFF, control_mode);
- if (nav_res == TRANSITION_CHANGED) {
- mavlink_log_info(mavlink_fd, "[cmd] TAKEOFF on command");
- }
+ if (nav_res == TRANSITION_CHANGED) {
+ mavlink_log_info(mavlink_fd, "[cmd] TAKEOFF on command");
+ }
- if (nav_res != TRANSITION_DENIED) {
- result = VEHICLE_CMD_RESULT_ACCEPTED;
+ if (nav_res != TRANSITION_DENIED) {
+ result = VEHICLE_CMD_RESULT_ACCEPTED;
+ } else {
+ result = VEHICLE_CMD_RESULT_TEMPORARILY_REJECTED;
+ }
} else {
+ /* reject TAKEOFF not armed */
result = VEHICLE_CMD_RESULT_TEMPORARILY_REJECTED;
}