aboutsummaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorLorenz Meier <lm@inf.ethz.ch>2013-12-13 08:10:42 -0800
committerLorenz Meier <lm@inf.ethz.ch>2013-12-13 08:10:42 -0800
commit3e708f881eecafbac19730f0801f8654399028ff (patch)
tree513a606eeb910a704963d09a6d3ef842fceb0054 /src/modules
parent39dcda3996b7c988c66bb4678f35bd45e0cc5d49 (diff)
parentea9fcaa27ffc8e1edbb8c7a7dec768208944da3c (diff)
downloadpx4-firmware-3e708f881eecafbac19730f0801f8654399028ff.tar.gz
px4-firmware-3e708f881eecafbac19730f0801f8654399028ff.tar.bz2
px4-firmware-3e708f881eecafbac19730f0801f8654399028ff.zip
Merge pull request #538 from thomasgubler/commander_localpos
update the commander to only use local pos for landing detection when on...
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/commander/commander.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp
index ace13bb78..dfd4d2f73 100644
--- a/src/modules/commander/commander.cpp
+++ b/src/modules/commander/commander.cpp
@@ -871,7 +871,7 @@ int commander_thread_main(int argc, char *argv[])
check_valid(local_position.timestamp, POSITION_TIMEOUT, local_position.xy_valid, &(status.condition_local_position_valid), &status_changed);
check_valid(local_position.timestamp, POSITION_TIMEOUT, local_position.z_valid, &(status.condition_local_altitude_valid), &status_changed);
- if (status.condition_local_altitude_valid) {
+ if (status.is_rotary_wing && status.condition_local_altitude_valid) {
if (status.condition_landed != local_position.landed) {
status.condition_landed = local_position.landed;
status_changed = true;
@@ -1539,7 +1539,8 @@ check_navigation_state_machine(struct vehicle_status_s *status, struct vehicle_c
// TODO AUTO_LAND handling
if (status->navigation_state == NAVIGATION_STATE_AUTO_TAKEOFF) {
/* don't switch to other states until takeoff not completed */
- if (local_pos->z > -takeoff_alt || status->condition_landed) {
+ // XXX: only respect the condition_landed when the local position is actually valid
+ if (status->is_rotary_wing && status->condition_local_altitude_valid && (local_pos->z > -takeoff_alt || status->condition_landed)) {
return TRANSITION_NOT_CHANGED;
}
}
@@ -1549,7 +1550,7 @@ check_navigation_state_machine(struct vehicle_status_s *status, struct vehicle_c
status->navigation_state != NAVIGATION_STATE_AUTO_MISSION &&
status->navigation_state != NAVIGATION_STATE_AUTO_RTL) {
/* possibly on ground, switch to TAKEOFF if needed */
- if (local_pos->z > -takeoff_alt || status->condition_landed) {
+ if (status->is_rotary_wing && status->condition_local_altitude_valid && (local_pos->z > -takeoff_alt || status->condition_landed)) {
res = navigation_state_transition(status, NAVIGATION_STATE_AUTO_TAKEOFF, control_mode);
return res;
}