diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2013-11-26 13:47:37 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2013-11-26 13:47:37 +0100 |
commit | a94ed67b3fefa5437d0322948190c02d69f82fea (patch) | |
tree | dca8f66715e300204ac514d94d0145dc543e33d0 /src | |
parent | 5428eab23b1e188ce4ca2203e08820cde7d23990 (diff) | |
download | px4-firmware-a94ed67b3fefa5437d0322948190c02d69f82fea.tar.gz px4-firmware-a94ed67b3fefa5437d0322948190c02d69f82fea.tar.bz2 px4-firmware-a94ed67b3fefa5437d0322948190c02d69f82fea.zip |
update the commander to only use local pos for landing detection when on rotary wing
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/commander/commander.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index 905d5dee5..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; @@ -1540,7 +1540,7 @@ check_navigation_state_machine(struct vehicle_status_s *status, struct vehicle_c if (status->navigation_state == NAVIGATION_STATE_AUTO_TAKEOFF) { /* don't switch to other states until takeoff not completed */ // XXX: only respect the condition_landed when the local position is actually valid - if (status->condition_local_altitude_valid && (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)) { return TRANSITION_NOT_CHANGED; } } @@ -1550,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; } |