add safety check for orbit in navigator. Prevents issues with old qgc versions

This commit is contained in:
Thomas Gubler 2013-11-26 15:24:16 +01:00
parent 9a79ad4cdb
commit 126b0567fe
1 changed files with 3 additions and 2 deletions

View File

@ -952,13 +952,14 @@ Navigator::check_mission_item_reached()
uint64_t now = hrt_absolute_time();
float orbit;
if (_mission_item_triplet.current.nav_cmd == NAV_CMD_WAYPOINT) {
if (_mission_item_triplet.current.nav_cmd == NAV_CMD_WAYPOINT && _mission_item_triplet.current.radius > 0.01f) {
orbit = _mission_item_triplet.current.radius;
} else if (_mission_item_triplet.current.nav_cmd == NAV_CMD_LOITER_TURN_COUNT ||
_mission_item_triplet.current.nav_cmd == NAV_CMD_LOITER_TIME_LIMIT ||
_mission_item_triplet.current.nav_cmd == NAV_CMD_LOITER_UNLIMITED) {
_mission_item_triplet.current.nav_cmd == NAV_CMD_LOITER_UNLIMITED &&
_mission_item_triplet.current.loiter_radius > 0.01f) {
orbit = _mission_item_triplet.current.loiter_radius;
} else {