12 KiB
SparkFun u-blox Arduino GNSS Library - AssistNowTM
v2.1.0 of the library adds support for u-blox AssistNowTM Assisted GNSS (A-GNSS) which can dramatically reduce the time-to-first-fix.
To use AssistNow Online or AssistNow Offline, you will need a token to access the u-blox Thingstream server. See below for details.
AssistNowTM Online
With AssistNow Online, an Internet connected host downloads assistance data from the u-blox AssistNow Online service to the receiver at system start-up. AssistNow Online data is valid for 2 - 4 hours; beyond that fresh data must be downloaded.
Please see the AssistNow_Online examples for more details. These examples were written for the ESP32, but will run on other platforms too.
The new functions we've added to the library to support AssistNow Online are described Code Support for AssistNow below.
AssistNowTM Offline
With the AssistNow Offline service, users can download long-term orbit data over the Internet at their convenience. The orbit data can be stored in the memory of the application processor. The function requires no connectivity at system start-up, enabling a position fix within seconds, even when no network is available. AssistNow Offline offers augmentation for up to 35 days.
Please see the AssistNow_Offline examples for more details. These examples were written for the ESP32, but will run on other platforms too.
Note: AssistNow Offline is not supported by the ZED-F9P. "The ZED-F9P supports AssistNow Online only."
The new functions we've added to the library to support AssistNow Offline are described Code Support for AssistNow below.
AssistNowTM Autonomous
AssistNow Autonomous provides aiding information without the need for a host or external network connection. Based on previous broadcast satellite ephemeris data downloaded to and stored by the GNSS receiver, AssistNow Autonomous automatically generates accurate predictions of satellite orbital data (“AssistNow Autonomous data”) that is usable for future GNSS position fixes.
The benefits of AssistNow Autonomous are:
- Faster fix in situations where GNSS satellite signals are weak
- No connectivity required
- Compatible with AssistNow Online (can work stand-alone, or in tandem with AssistNow Online service)
- No integration effort; calculations are done in the background, transparent to the user
AssistNow Autonomous offers augmentation for up to 6 days.
Please see the AssistNow_Autonomous examples for more details.
The new functions we've added to the library to support AssistNow Autonomous are described Code Support for AssistNow below.
AssistNow Service Token
To be able to use AssistNow Online or AssistNow Offline, you will need a token to access the u-blox Thingstream server.
The following u-blox resources contain useful information:
- AssistNow - u-blox A-GNSS services
- AssistNow Product Summary
- AssistNow User Guide
- Thingstream Pricing
You can apply for a free AssistNow Service Evaluation Token by completing the request form:
The free AssistNow Developer token entitles you to:
- AssistNow Online Developer: 100K free location requests per month. Capped.
- AssistNow Offline Developer: 20K free location requests per month. Capped.
- CellLocate Developer: 5K free location requests per month. Capped.
The free token will expire after 90 days, but you can continue to use it beyond that by registering it on Thingstream.
Code Support for AssistNow
pushAssistNowData allows the AssistNow Online data or AssistNow Offline data from the u-blox server to be pushed to the module. As the ESP32 HTTP GET function returns a String, we've included overloaded functions which allow you to pass the data as a String or as const uint8_t *.
The String-based function declarations are:
- size_t pushAssistNowData(const String &dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
- size_t pushAssistNowData(bool skipTime, const String &dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
- size_t pushAssistNowData(size_t offset, bool skipTime, const String &dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
The const uint8_t * function declarations are:
- size_t pushAssistNowData(const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
- size_t pushAssistNowData(bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
- size_t pushAssistNowData(size_t offset, bool skipTime, const uint8_t *dataBytes, size_t numDataBytes, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
dataBytes is a pointer to the AssistNow data.
numDataBytes is the length of the AssistNow data.
pushAssistNowData pushes individual packets of data to the u-blox module. Sending all of the data contiguously would overload the module, so pushAssistNowData can either:
- insert a small delay between each packet (the default is 7ms)
- or use the
UBX-MGA-ACK-DATA0acknowledgement message to acknowledge each packet
mgaAck controls which method is used.
- if
mgaAckisSFE_UBLOX_MGA_ASSIST_ACK_NO(default), a delay ofmaxWaitmilliseconds is inserted between each packet.maxWaitdefaults to 7ms. - if
mgaAckisSFE_UBLOX_MGA_ASSIST_ACK_YES, acknowledgement messages will be expected with a timeout ofmaxWaitmilliseconds. The default timeout is again 7ms, but you can change this if required by passing a different value. - if
mgaAckisSFE_UBLOX_MGA_ASSIST_ACK_ENQUIRE, the code will poll the module to enquire if the acknowledgement messages are enabled. If they are, they will be used. If not, a delay is used.
setAckAiding enables or disables the acknowledgement messages. By default they are disabled. setAckAiding(1) will enable them. setAckAiding(0) will disable them again.
- bool setAckAiding(uint8_t ackAiding, uint16_t maxWait);
getAckAiding returns 1 if the acknowledgement messages are enabled, 0 if they are disabled. 255 indicates an error or timeout.
- uint8_t getAckAiding(uint16_t maxWait);
AssistNow Online data is valid for 2-4 hours. 'Stale' data can be re-used but:
pushAssistNowDataneeds to be told to skip the time information contained in the AssistNow data- the user needs to provide the module with UTC time separately
The skipTime parameter tells pushAssistNowData to skip any time information in the data. skipTime is bool. Set it to true to skip the time information.
UTC time can be pushed to the module first by calling setUTCTimeAssistance:
- bool setUTCTimeAssistance(uint16_t year, uint8_t month, uint8_t day, uint8_t hour, uint8_t minute, uint8_t second, uint32_t nanos, uint16_t tAccS, uint32_t tAccNs, uint8_t source, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
Only the year, month, day, hour, minute and second parameters are mandatory. The others default to sensible values. Again mgaAck and maxWait control if a delay is used when configuring the time, or if an acknowledgement message will be expected.
nanos (nanoseconds), tAccS (time accuracy estimate (seconds)), tAccNs (time accuracy estimate (nanoseconds)) and source (if a clock signal will be provided on EXT_INT) are optional, but are available for advanced users.
year numbering starts at 0; 2021 is 2021, not 121 (years since 1900). month and day numbering starts at 1, not 0.
Call setUTCTimeAssistance before pushAssistNowData.
Initial Position Assistance
You can further decrease the time-to-first-fix by also providing the receiver's position - if known. There are two ways to do this:
- The position can be specified when requesting AssistNow Online data from the server:
- include the key name
latwith the approximate user latitude in WGS 84 expressed in degrees and fractional degrees. Must be in range -90 to 90. Example:lat=47.2; - include the key name
lonwith the approximate user longitude in WGS 84 expressed in degrees and fractional degrees. Must be in range -180 to 180. Example:lon=8.55; - include the key name
altwith the approximate user altitude above WGS 84 Ellipsoid in meters. If this value is not provided, the server assumes an altitude of 0 meters. Must be in range -1000 to 50000 - if possible, include the key name
paccwith the approximate accuracy of submitted position in meters. If this value is not provided, the server assumes an accuracy of 300 km. Must be in range 0 to 6000000 - the position assistance data will then be automatically included in the AssistNow Online data
- include the key name
- Provide initial position assistance data by calling one of:
- bool setPositionAssistanceXYZ(int32_t ecefX, int32_t ecefY, int32_t ecefZ, uint32_t posAcc, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
- The units for
ecefX/Y/ZandposAcc(stddev) are cm - bool setPositionAssistanceLLH(int32_t lat, int32_t lon, int32_t alt, uint32_t posAcc, sfe_ublox_mga_assist_ack_e mgaAck, uint16_t maxWait);
- The units for
latandlonare degrees * 1e-7 (WGS84). The units foralt(WGS84) andposAcc(stddev) are cm (not m)
Additional Code Support for AssistNow Offline
AssistNow Offline data downloaded from the u-blox server can contain 1-5 weeks of data. However, only the data for today should be pushed the module. Sending data for past or future days will confuse the module.
findMGAANOForDate can be used to find the location of the start of the UBX-MGA-ANO data for the specified date within the offline data. That location can then be passed to pushAssistNowData using the offset parameter.
- size_t findMGAANOForDate(const uint8_t *dataBytes, size_t numDataBytes, uint16_t year, uint8_t month, uint8_t day, uint8_t daysIntoFuture);
The sequence of events is:
- call
findMGAANOForDatepassing theyear,monthanddayfor today.findMGAANOForDatewill return the location / offset of the data for today within the offline data. - call
findMGAANOForDateagain passing theyear,monthanddayfor today but also setdaysIntoFutureto 1.findMGAANOForDatewill then return the location / offset of the data for tomorrow (one day into the future). - call
pushAssistNowDatasetting:offsetto the location (offset) of today's data within the offline dataskipTimetotruenumDataBytesto ((tomorrow's location) - (today's location)). Only the offline data for today will be pushed.
findMGAANOForDate will return a value of numDataBytes if the data for the chosen day cannot be found.
Again, call setUTCTimeAssistance before pushAssistNowData.