diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-17 23:32:14 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-01-17 23:32:14 +0100 |
commit | 9dbcea4b1f25b7c8b9d1f243af876c6e57c086d4 (patch) | |
tree | 1733e405897c665f7f5635e9c5e57b6e78777fb1 /src/modules/commander | |
parent | 6324513b91702d8fa877e915c91a6dcef9790faa (diff) | |
parent | 378dcc53d63a18811f17ab6f60c66b8315d8db25 (diff) | |
download | px4-firmware-9dbcea4b1f25b7c8b9d1f243af876c6e57c086d4.tar.gz px4-firmware-9dbcea4b1f25b7c8b9d1f243af876c6e57c086d4.tar.bz2 px4-firmware-9dbcea4b1f25b7c8b9d1f243af876c6e57c086d4.zip |
Merge branch 'land_detector'
Diffstat (limited to 'src/modules/commander')
-rw-r--r-- | src/modules/commander/commander.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/modules/commander/commander.cpp b/src/modules/commander/commander.cpp index aac6b2002..3c71195fb 100644 --- a/src/modules/commander/commander.cpp +++ b/src/modules/commander/commander.cpp @@ -84,6 +84,7 @@ #include <uORB/topics/geofence_result.h> #include <uORB/topics/telemetry_status.h> #include <uORB/topics/vtol_vehicle_status.h> + #include <uORB/topics/vehicle_land_detected.h> #include <drivers/drv_led.h> #include <drivers/drv_hrt.h> @@ -1017,6 +1018,11 @@ int commander_thread_main(int argc, char *argv[]) struct vehicle_local_position_s local_position; memset(&local_position, 0, sizeof(local_position)); + /* Subscribe to land detector */ + int land_detector_sub = orb_subscribe(ORB_ID(vehicle_land_detected)); + struct vehicle_land_detected_s land_detector; + memset(&land_detector, 0, sizeof(land_detector)); + /* * The home position is set based on GPS only, to prevent a dependency between * position estimator and commander. RAW GPS is more than good enough for a @@ -1405,9 +1411,15 @@ int commander_thread_main(int argc, char *argv[]) check_valid(local_position.timestamp, POSITION_TIMEOUT, local_position.z_valid, &(status.condition_local_altitude_valid), &status_changed); + /* Update land detector */ + orb_check(land_detector_sub, &updated); + if(updated) { + orb_copy(ORB_ID(vehicle_land_detected), land_detector_sub, &land_detector); + } + if (status.condition_local_altitude_valid) { - if (status.condition_landed != local_position.landed) { - status.condition_landed = local_position.landed; + if (status.condition_landed != land_detector.landed) { + status.condition_landed = land_detector.landed; status_changed = true; if (status.condition_landed) { |