From 6dc95c6b6beb0433ed05890981b37bc7a0ed6b70 Mon Sep 17 00:00:00 2001 From: DonLakeFlyer Date: Fri, 9 Jun 2017 11:35:50 -0700 Subject: [PATCH] Handle ArduPilot GPS message --- src/Vehicle/Vehicle.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Vehicle/Vehicle.cc b/src/Vehicle/Vehicle.cc index d007bd914..0f043733a 100644 --- a/src/Vehicle/Vehicle.cc +++ b/src/Vehicle/Vehicle.cc @@ -669,6 +669,11 @@ void Vehicle::_handleGlobalPositionInt(mavlink_message_t& message) mavlink_global_position_int_t globalPositionInt; mavlink_msg_global_position_int_decode(&message, &globalPositionInt); + // ArduPilot sends bogus GLOBAL_POSITION_INT messages with lat/lat/alt 0/0/0 even when it has not gps signal + if (globalPositionInt.lat == 0 && globalPositionInt.lon == 0 && globalPositionInt.alt == 0) { + return; + } + _globalPositionIntMessageAvailable = true; //-- Set these here and emit a single signal instead of 3 for the same variable (_coordinate) _coordinate.setLatitude(globalPositionInt.lat / (double)1E7); -- 2.22.0