diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-17 21:02:17 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-07-17 21:02:17 +0200 |
commit | c01567c047f295e3ffea7d01a7e239ac4f79a498 (patch) | |
tree | 7acc1919a171553d8e90a265300e76a2d61d2cc9 /src/modules | |
parent | 213fe0cc20ada8b8581a65f73c68b4efe6508405 (diff) | |
download | px4-firmware-c01567c047f295e3ffea7d01a7e239ac4f79a498.tar.gz px4-firmware-c01567c047f295e3ffea7d01a7e239ac4f79a498.tar.bz2 px4-firmware-c01567c047f295e3ffea7d01a7e239ac4f79a498.zip |
Check if waypoint altitude is relative. Fixes #1197
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/navigator/mission_feasibility_checker.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/modules/navigator/mission_feasibility_checker.cpp b/src/modules/navigator/mission_feasibility_checker.cpp index dd7f4c801..d45488d5a 100644 --- a/src/modules/navigator/mission_feasibility_checker.cpp +++ b/src/modules/navigator/mission_feasibility_checker.cpp @@ -135,12 +135,15 @@ bool MissionFeasibilityChecker::checkHomePositionAltitude(dm_item_t dm_current, } } - if (home_alt > missionitem.altitude) { + /* calculate the global waypoint altitude */ + float wp_alt = (missionitem.altitude_is_relative) ? missionitem.altitude + home_alt ? missionitem.altitude; + + if (home_alt > wp_alt) { if (throw_error) { - mavlink_log_info(_mavlink_fd, "Waypoint %d below home", i); + mavlink_log_critical(_mavlink_fd, "Warning: Waypoint %d below home", i); return false; } else { - mavlink_log_info(_mavlink_fd, "#audio: warning waypoint %d below home", i); + mavlink_log_critical(_mavlink_fd, "Rejecting Mission: Waypoint %d below home", i); return true; } } |