Description
Subject of the issue
I have two ZED-F9P units, each with their own antenna, connected to an ESP32. I am trying use the two units in a moving base setup, as described here - specifically sections 2.2.1 and 2.3.2. I am trying to get the latitude and longitude from the base unit, and the relative position data from the rover unit. Most of the time, the values I get are fine. However, there can be long periods of time (up to 20 seconds) where the getPVT() method returns false. I've also noticed an instance where the callback didn't fire for almost 20 seconds. I'm wondering if that's to be expected, or if there is some way to figure out what the issue is.
Your workbench
- What development board or microcontroller are you using? ESP32-WROOM-32UE
- What version of hardware or breakout board are you using? Sparkfun u-blox GPS-RTK2 ZED-F9P.
- How is the breakout board wired to your microcontroller? Via I2C. The RX pin on the base unit is also connected to the TX pin on the rover unit.
- How is everything being powered? Via USB (both the ESP32 and the ZED-F9P).
- Are there any additional details that may help us help you?
Firmware for ZED-F9P is HPG1.50, although I have also tested using HPG1.13 and had the same problems. When testing, the antennae have a clear view of the sky.
Steps to reproduce
Example code below.
#include <Wire.h> // I2C needed for GPS-RTK2.
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS fwdGPS;
SFE_UBLOX_GNSS revGPS;
const byte FWD_I2C_ADDRESS = 0x42;
const byte REV_I2C_ADDRESS = 0x43;
void setup() {
delay(2000);
Serial.begin(115200);
Wire.begin();
if (fwdGPS.begin(Wire, FWD_I2C_ADDRESS) == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Forward GPS not detected at 0x42 I2C address. Please check wiring or reprogram its address. Freezing."));
while (1);
}
fwdGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
fwdGPS.setSerialRate(460800, COM_PORT_UART1);
fwdGPS.setSerialRate(460800, COM_PORT_UART2);
fwdGPS.setVal8(UBLOX_CFG_MSGOUT_UBX_NAV_RELPOSNED_UART1, 1);
fwdGPS.setNavigationFrequency(5);
fwdGPS.setAutoPVT(true, false);
fwdGPS.setAutoRELPOSNEDcallbackPtr(&RELPOSNEDcallback);
fwdGPS.saveConfiguration(); //Save the current settings to flash and BBR
if (revGPS.begin(Wire, REV_I2C_ADDRESS) == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Reverse GPS not detected at 0x43 I2C address. Please check wiring or reprogram its address. Freezing."));
while (1);
}
revGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
revGPS.setSerialRate(460800, COM_PORT_UART1);
revGPS.setSerialRate(460800, COM_PORT_UART2);
revGPS.setVal8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1074_UART2, 1);
revGPS.setVal8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1084_UART2, 1);
revGPS.setVal8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1094_UART2, 1);
revGPS.setVal8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1124_UART2, 1);
revGPS.setVal8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE1230_UART2, 1);
revGPS.setVal8(UBLOX_CFG_MSGOUT_RTCM_3X_TYPE4072_0_UART2, 1);
revGPS.setNavigationFrequency(5);
revGPS.setAutoPVT(true);
revGPS.saveConfiguration(); //Save the current settings to flash and BBR
revGPS.disableSurveyMode();
}
void RELPOSNEDcallback(UBX_NAV_RELPOSNED_data_t *ubxDataStruct){
if(revGPS.getPVT())
{
Serial.print("Rear Latitude: ");
Serial.println(revGPS.getLatitude());
Serial.print("Rear Longitude: ");
Serial.println(revGPS.getLongitude());
}
else
{
Serial.println("revGPS.getPVT() returned false");
}
//I don't think I have to check fwdGPS.getPVT() since we call fwdGPS.checkUblox() in the loop method, implicit update set to false
Serial.print("Forward Latitude: ");
Serial.println(fwdGPS.getLatitude());
Serial.print("Forward Longitude: ");
Serial.println(fwdGPS.getLongitude());
if(ubxDataStruct->flags.bits.relPosValid && ubxDataStruct->flags.bits.relPosHeadingValid)
{
Serial.print("relPosN: ");
Serial.println((float)ubxDataStruct->relPosN / 100);
Serial.print("relPosE: ");
Serial.println((float)ubxDataStruct->relPosE / 100);
Serial.print("relPosHeading: ");
Serial.println(ubxDataStruct->relPosHeading);
}
else
{
Serial.println("Either relPosValid or relPosHeadingValid were false");
}
}
void loop(){
fwdGPS.checkUblox();
fwdGPS.checkCallbacks();
}
Expected behavior
The getPVT() method shouldn't return false for more than 5 seconds at a time ideally. The callback method should also run at least every 5 seconds.
Actual behavior
There are long periods of time where either getPVT() returns false or the callback method doesn't fire.