Skip to content

v3.0.16 #34

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 4 commits into from
Jun 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
109 changes: 109 additions & 0 deletions examples/Basics/Example33_NAVSAT/Example33_NAVSAT.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
/*
Polling NAV SAT
By: Paul Clark
SparkFun Electronics
Date: June 5th, 2023
License: MIT. See license file for more information.

Feel like supporting open source hardware?
Buy a board from SparkFun!
SparkFun GPS-RTK2 - ZED-F9P (GPS-15136) https://www.sparkfun.com/products/15136
SparkFun GPS-RTK-SMA - ZED-F9P (GPS-16481) https://www.sparkfun.com/products/16481
SparkFun MAX-M10S Breakout (GPS-18037) https://www.sparkfun.com/products/18037
SparkFun ZED-F9K Breakout (GPS-18719) https://www.sparkfun.com/products/18719
SparkFun ZED-F9R Breakout (GPS-16344) https://www.sparkfun.com/products/16344

Hardware Connections:
Plug a Qwiic cable into the GPS and a BlackBoard
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 <Wire.h> //Needed for I2C to GPS

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

void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println("SparkFun u-blox Example");

Wire.begin();

//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial

myGNSS.setPacketCfgPayloadSize(UBX_NAV_SAT_MAX_LEN); // Allocate extra RAM to store the full NAV SAT data

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

myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR

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

void loop()
{
if (myGNSS.getNAVSAT()) // Poll the latest NAV SAT data
{
Serial.println();

// See u-blox_structs.h for the full definition of UBX_NAV_SAT_data_t
Serial.print(F("New NAV SAT data received. It contains data for "));
Serial.print(myGNSS.packetUBXNAVSAT->data.header.numSvs);
if (myGNSS.packetUBXNAVSAT->data.header.numSvs == 1)
Serial.println(F(" SV."));
else
Serial.println(F(" SVs."));

// Just for giggles, print the signal strength for each SV as a barchart
for (uint16_t block = 0; block < myGNSS.packetUBXNAVSAT->data.header.numSvs; block++) // For each SV
{
switch (myGNSS.packetUBXNAVSAT->data.blocks[block].gnssId) // Print the GNSS ID
{
case 0:
Serial.print(F("GPS "));
break;
case 1:
Serial.print(F("SBAS "));
break;
case 2:
Serial.print(F("Galileo "));
break;
case 3:
Serial.print(F("BeiDou "));
break;
case 4:
Serial.print(F("IMES "));
break;
case 5:
Serial.print(F("QZSS "));
break;
case 6:
Serial.print(F("GLONASS "));
break;
default:
Serial.print(F("UNKNOWN "));
break;
}

Serial.print(myGNSS.packetUBXNAVSAT->data.blocks[block].svId); // Print the SV ID

if (myGNSS.packetUBXNAVSAT->data.blocks[block].svId < 10) Serial.print(F(" "));
else if (myGNSS.packetUBXNAVSAT->data.blocks[block].svId < 100) Serial.print(F(" "));
else Serial.print(F(" "));

// Print the signal strength as a bar chart
for (uint8_t cno = 0; cno < myGNSS.packetUBXNAVSAT->data.blocks[block].cno; cno++)
Serial.print(F("="));

Serial.println();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
Open the serial monitor at 115200 baud to see the output

After calibrating the module and securing it to your vehicle such that it's
stable within 2 degrees, and the board is oriented correctly with regards to
the vehicle's frame, you can now read the vehicle's "attitude". The attitude
includes the vehicle's heading, pitch, and roll. You can also check the
accuracy of those readings.

getEsfAlignment (UBX-ESF-ALG) reports the status and alignment angles of the IMU within the vehicle.
These define the rotation of the IMU frame within the vehicle (installation frame) - not the heading
of the vehicle itself. The vehicle attitude solution is reported separately by getNAVATT (UBX-NAV-ATT).
*/

#include <Wire.h> //Needed for I2C to GNSS
Expand All @@ -44,6 +41,8 @@ void setup()

myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)

myGNSS.setESFAutoAlignment(true); //Enable Automatic IMU-mount Alignment

if (myGNSS.getEsfInfo()){

Serial.print(F("Fusion Mode: "));
Expand All @@ -64,19 +63,31 @@ void loop()
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
if (myGNSS.getEsfAlignment()) // Poll new ESF ALG data
{
Serial.print(F("Status: "));
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.status);
Serial.print(F("IMU-Mount Alignment: On/Off: "));
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.autoMntAlgOn);
Serial.print(F(" Status: "));
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.status);
Serial.print(F(" Roll: "));
Serial.print(myGNSS.getESFroll(), 2); // Use the helper function to get the roll in degrees
Serial.print(F(" Pitch: "));
Serial.print(myGNSS.getESFpitch(), 2); // Use the helper function to get the pitch in degrees
Serial.print(F(" Heading: "));
Serial.print(F(" Yaw: "));
Serial.print(myGNSS.getESFyaw(), 2); // Use the helper function to get the yaw in degrees
Serial.print(F(" Errors: "));
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.tiltAlgError);
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.yawAlgError);
Serial.println(myGNSS.packetUBXESFALG->data.error.bits.angleError);
}

if (myGNSS.getNAVATT()) // Poll new NAV ATT data
{
Serial.print(F("Vehicle Attitude: Roll: "));
Serial.print(myGNSS.getATTroll(), 2); // Use the helper function to get the roll in degrees
Serial.print(F(" Pitch: "));
Serial.print(myGNSS.getATTpitch(), 2); // Use the helper function to get the pitch in degrees
Serial.print(F(" Heading: "));
Serial.println(myGNSS.getATTheading(), 2); // Use the helper function to get the heading in degrees
}

delay(250);
}
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=SparkFun u-blox GNSS v3
version=3.0.15
version=3.0.16
author=SparkFun Electronics <[email protected]>
maintainer=SparkFun Electronics <sparkfun.com>
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>
Expand Down
14 changes: 14 additions & 0 deletions src/u-blox_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,20 @@ typedef struct
struct
{
uint8_t invalidLlh : 1; // 1 = Invalid lon, lat, height and hMSL
uint8_t lastCorrectionAge : 4; // Age of the most recently received differential correction:
// 0: Not available
// 1: Age between 0 and 1 second
// 2: Age between 1 (inclusive) and 2 seconds
// 3: Age between 2 (inclusive) and 5 seconds
// 4: Age between 5 (inclusive) and 10 seconds
// 5: Age between 10 (inclusive) and 15 seconds
// 6: Age between 15 (inclusive) and 20 seconds
// 7: Age between 20 (inclusive) and 30 seconds
// 8: Age between 30 (inclusive) and 45 seconds
// 9: Age between 45 (inclusive) and 60 seconds
// 10: Age between 60 (inclusive) and 90 seconds
// 11: Age between 90 (inclusive) and 120 seconds
// >=12: Age greater or equal than 120 seconds
} bits;
} flags3;
uint8_t reserved1[5];
Expand Down