From d9e31d67aa0d742e709616c349f3fc958598c9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Mi=C5=A1i=C4=87?= Date: Fri, 7 May 2021 14:07:33 +0200 Subject: [PATCH] gps: Updated timeout time for the rover with moving base The MB rover will wait as long as possible to compute a navigation solution, possibly lowering the navigation rate all the way to 1 Hz while doing so. --- src/drivers/gps/gps.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/drivers/gps/gps.cpp b/src/drivers/gps/gps.cpp index f20d9a8250..3b86b6dc23 100644 --- a/src/drivers/gps/gps.cpp +++ b/src/drivers/gps/gps.cpp @@ -75,7 +75,8 @@ #include #endif /* __PX4_LINUX */ -#define TIMEOUT_5HZ 500 +#define TIMEOUT_1HZ 1300 //!< Timeout time in mS, 1000 mS (1Hz) + 300 mS delta for error +#define TIMEOUT_5HZ 500 //!< Timeout time in mS, 200 mS (5Hz) + 300 mS delta for error #define RATE_MEASUREMENT_PERIOD 5000000 typedef enum { @@ -837,8 +838,15 @@ GPS::run() } int helper_ret; + unsigned receive_timeout = TIMEOUT_5HZ; - while ((helper_ret = _helper->receive(TIMEOUT_5HZ)) > 0 && !should_exit()) { + if (ubx_mode == GPSDriverUBX::UBXMode::RoverWithMovingBase) { + /* The MB rover will wait as long as possible to compute a navigation solution, + * possibly lowering the navigation rate all the way to 1 Hz while doing so. */ + receive_timeout = TIMEOUT_1HZ; + } + + while ((helper_ret = _helper->receive(receive_timeout)) > 0 && !should_exit()) { if (helper_ret & 1) { publish();