Skip to content

Add support for AssistNow Online, Offline & Autonomous #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d610969
Add READMEs. Add AssistNow_Online Example1
PaulZC Nov 24, 2021
28e7c12
Add ring buffer for incoming MGA ACKs
PaulZC Nov 25, 2021
19ff31b
AssistNow_Online Example1 is working nicely!
PaulZC Nov 25, 2021
9e86708
Add setUTCTimeAssistance. Change pushAssistNowData to const uint8_t *…
PaulZC Nov 26, 2021
142ca98
Remove debug messages. Update Example1
PaulZC Nov 26, 2021
ae65547
Add Example2 AssistNow Online with time delay allowing 'stale' data t…
PaulZC Nov 26, 2021
859a5d0
Add support for AssistNow Offline. Add Example. Add findMGAANOForDate.
PaulZC Nov 26, 2021
0339462
Example updates. Remove default parameters from Internal functions.
PaulZC Nov 29, 2021
0edeaf0
Update README.md
PaulZC Nov 29, 2021
7e37bf6
Update README.md
PaulZC Nov 29, 2021
cc27ec2
Add setPositionAssistanceXYZ, setPositionAssistanceLLH and a new exam…
PaulZC Nov 29, 2021
611e086
Add getAopCfg and setAopCfg - for AssistNow Autonomous
PaulZC Nov 29, 2021
64f830f
Add auto support UBX-NAV-AOPSTATUS (AssistNow Autonomous)
PaulZC Nov 29, 2021
33b8e1d
Create Example1_AssistNowAutonomous_Read.ino
PaulZC Nov 29, 2021
d014318
Add readNavigationDatabase. Update the AssistNow Autonomous example.
PaulZC Nov 30, 2021
235df31
Update README.md
PaulZC Nov 30, 2021
ef5abac
Add auto support for NAV SAT. Add NAV SAT callback example. Add final…
PaulZC Dec 1, 2021
e21a1b2
v2.1.0
PaulZC Dec 1, 2021
52cb8f2
Update CallbackExample7_NAV_SAT.ino
PaulZC Dec 1, 2021
467d2fb
Add note re. AssistNow Autonomous not supported on ZED-F9P
PaulZC Dec 1, 2021
0f5f8eb
Correct the return value checks for pushAssistNowDataInternal
PaulZC Dec 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ Migrating to v2.0 is easy. There are two small changes all users will need to ma

If you are using the Dead Reckoning Sensor Fusion or High Dynamic Rate messages, you will need to make more small changes to your code. Please see the [dead reckoning examples](./examples/Dead_Reckoning) for more details. There is more detail available in [Theory.md](./Theory.md#migrating-your-code-to-v20) if you need it.

## AssistNow<sup>TM</sup>

v2.1.0 of the library adds support for u-blox AssistNow<sup>TM</sup> Assisted GNSS (A-GNSS) which can dramatically reduce the time-to-first-fix. You can find further details in the [AssistNow Examples folder](./examples/AssistNow).

## Memory Usage

The u-blox GNSS library has grown considerably over the years and v2.0.8 came very close to completely filling the program memory on platforms like the ATmega328 (Arduino Uno).
Expand Down
2 changes: 1 addition & 1 deletion Theory.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ When the user calls one of the methods the library will poll the u-blox module f
* Wait for a minimum of 25 ms between polls (configured dynamically when update rate is set)
* Write 0xFD to module
* Read two bytes (0xFD and 0xFE) for bytes available
* If 0x7F or 0xFF then no bytes are available
* Otherwise, read number of bytes and process into NMEA, UBX, or RTCM frame.
* If checksum is valid, flag frame as complete.

Expand Down Expand Up @@ -58,6 +57,7 @@ In v2.0, the full list of messages which can be processed and logged automatical
- UBX-NAV-CLOCK (0x01 0x22): Clock solution
- UBX-NAV-SVIN (0x01 0x3B): Survey-in data (**only with High Precision GNSS products**)
- UBX-NAV-RELPOSNED (0x01 0x3C): Relative positioning information in NED frame (**only with High Precision GNSS products**)
- UBX-NAV-AOPSTATUS (0x01 0x60): AssistNow Autonomous status
- UBX-RXM-SFRBX (0x02 0x13): Broadcast navigation data subframe
- UBX-RXM-RAWX (0x02 0x15): Multi-GNSS raw measurement data (**only with ADR or High Precision GNSS or Time Sync products**)
- UBX-TIM-TM2 (0x0D 0x03): Time mark data
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
/*
Monitor AssistNow Autonomous data collection
By: SparkFun Electronics / Paul Clark
Date: November 29th, 2021
License: MIT. See license file for more information but you can
basically do whatever you want with this code.

This example shows how to enable and monitor AssistNow Autonomous data collection by the module.
A callback is used to monitor AssistNow Autonomous data availability for each satellite.
A second callback is used to print the AOPSTATUS status.

If your GNSS board has battery-backup for the RAM - and all SparkFun boards do! - then you can:
wait until the module has AssistNow Autonomous data for a few satellites;
power-cycle the board;
watch how fast it gets its first fix!

Note: this example will only work on boards which have plenty of RAM available.
The UBX-NAV-SAT information occupies several kBytes.

Note: this example will not work on the ZED-F9P. "The ZED-F9P supports AssistNow Online only."

Feel like supporting open source hardware?
Buy a board from SparkFun!
SparkFun Thing Plus - ESP32 WROOM: https://www.sparkfun.com/products/15663
SparkFun GPS Breakout - ZOE-M8Q (Qwiic): https://www.sparkfun.com/products/15193

Hardware Connections:
Plug a Qwiic cable into the GNSS and a ESP32 Thing Plus
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
Open the serial monitor at 115200 baud to see the output
*/

#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Callback: printSATdata will be called when new NAV SAT data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_SAT_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoNAVSATcallback
// / _____ This _must_ be UBX_NAV_SAT_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void printSATdata(UBX_NAV_SAT_data_t ubxDataStruct)
{
//Serial.println();

Serial.print(F("UBX-NAV-SAT contains data for "));
Serial.print(ubxDataStruct.header.numSvs);
if (ubxDataStruct.header.numSvs == 1)
Serial.println(F(" SV"));
else
Serial.println(F(" SVs"));

uint16_t numAopAvail = 0; // Count how many SVs have AssistNow Autonomous data available

for (uint16_t block = 0; block < ubxDataStruct.header.numSvs; block++) // For each SV
{
if (ubxDataStruct.blocks[block].flags.bits.aopAvail == 1) // If the aopAvail bit is set
numAopAvail++; // Increment the number of SVs
}

Serial.print(F("AssistNow Autonomous data is available for "));
Serial.print(numAopAvail);
if (numAopAvail == 1)
Serial.println(F(" SV"));
else
Serial.println(F(" SVs"));
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Callback: printAOPstatus will be called when new NAV AOPSTATUS data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_AOPSTATUS_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoNAVAOPSTATUScallback
// / _____ This _must_ be UBX_NAV_AOPSTATUS_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void printAOPstatus(UBX_NAV_AOPSTATUS_data_t ubxDataStruct)
{
//Serial.println();

Serial.print(F("AOPSTATUS status is "));
Serial.println(ubxDataStruct.status);
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

// Callback: printPVTdata will be called when new NAV PVT data arrives
// See u-blox_structs.h for the full definition of UBX_NAV_PVT_data_t
// _____ You can use any name you like for the callback. Use the same name when you call setAutoPVTcallback
// / _____ This _must_ be UBX_NAV_PVT_data_t
// | / _____ You can use any name you like for the struct
// | | /
// | | |
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
{
// Print the UBX-NAV-PVT data so we can see how quickly the fixType goes to 3D

Serial.println();

long latitude = ubxDataStruct.lat; // Print the latitude
Serial.print(F("Lat: "));
Serial.print(latitude);

long longitude = ubxDataStruct.lon; // Print the longitude
Serial.print(F(" Long: "));
Serial.print(longitude);
Serial.print(F(" (degrees * 10^-7)"));

long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
Serial.print(F(" Alt: "));
Serial.print(altitude);
Serial.print(F(" (mm)"));

byte fixType = ubxDataStruct.fixType; // Print the fix type
Serial.print(F(" Fix: "));
if(fixType == 0) Serial.print(F("No fix"));
else if(fixType == 1) Serial.print(F("Dead reckoning"));
else if(fixType == 2) Serial.print(F("2D"));
else if(fixType == 3) Serial.print(F("3D"));
else if(fixType == 4) Serial.print(F("GNSS + Dead reckoning"));
else if(fixType == 5) Serial.print(F("Time only"));

Serial.println();
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

void setup()
{
delay(1000);

Serial.begin(115200);
Serial.println(F("AssistNow Example"));

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Start I2C. Connect to the GNSS.

Wire.begin(); //Start I2C

//myGNSS.enableDebugging(Serial, true); // Uncomment this line to see the 'major' debug messages on Serial

if (myGNSS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("u-blox GPS not detected at default I2C address. Please check wiring. Freezing."));
while (1);
}
Serial.println(F("u-blox module connected"));

myGNSS.setI2COutput(COM_TYPE_UBX); //Turn off NMEA noise
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Enable AssistNow Autonomous data collection.

if (myGNSS.setAopCfg(1) == true)
{
Serial.println(F("aopCfg enabled"));
}
else
{
Serial.println(F("Could not enable aopCfg. Please check wiring. Freezing."));
while (1);
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// Enable automatic UBX-NAV-SAT and UBX-NAV-AOPSTATUS messages and set up the callbacks

myGNSS.setNavigationFrequency(1); //Produce one solution per second

myGNSS.setAutoNAVSATcallback(&printSATdata); // Enable automatic NAV SAT messages with callback to printSATdata
myGNSS.setAutoAOPSTATUScallback(&printAOPstatus); // Enable automatic NAV AOPSTATUS messages with callback to printAOPstatus
myGNSS.setAutoPVTcallback(&printPVTdata); // Enable automatic NAV PVT messages with callback to printPVTdata
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

void loop()
{
myGNSS.checkUblox(); // Check for the arrival of new data and process it.
myGNSS.checkCallbacks(); // Check if any callbacks are waiting to be processed.

Serial.print(".");
delay(50);
}
Loading