Skip to content

Commit 9b8840f

Browse files
authored
Merge pull request #34 from sparkfun/release_candidate
v3.0.16
2 parents eacf828 + b4d41a9 commit 9b8840f

File tree

4 files changed

+144
-10
lines changed

4 files changed

+144
-10
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
Polling NAV SAT
3+
By: Paul Clark
4+
SparkFun Electronics
5+
Date: June 5th, 2023
6+
License: MIT. See license file for more information.
7+
8+
Feel like supporting open source hardware?
9+
Buy a board from SparkFun!
10+
SparkFun GPS-RTK2 - ZED-F9P (GPS-15136) https://www.sparkfun.com/products/15136
11+
SparkFun GPS-RTK-SMA - ZED-F9P (GPS-16481) https://www.sparkfun.com/products/16481
12+
SparkFun MAX-M10S Breakout (GPS-18037) https://www.sparkfun.com/products/18037
13+
SparkFun ZED-F9K Breakout (GPS-18719) https://www.sparkfun.com/products/18719
14+
SparkFun ZED-F9R Breakout (GPS-16344) https://www.sparkfun.com/products/16344
15+
16+
Hardware Connections:
17+
Plug a Qwiic cable into the GPS and a BlackBoard
18+
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
19+
Open the serial monitor at 115200 baud to see the output
20+
*/
21+
22+
#include <Wire.h> //Needed for I2C to GPS
23+
24+
#include <SparkFun_u-blox_GNSS_v3.h> //http://librarymanager/All#SparkFun_u-blox_GNSS_v3
25+
SFE_UBLOX_GNSS myGNSS;
26+
27+
void setup()
28+
{
29+
Serial.begin(115200);
30+
while (!Serial); //Wait for user to open terminal
31+
Serial.println("SparkFun u-blox Example");
32+
33+
Wire.begin();
34+
35+
//myGNSS.enableDebugging(); // Uncomment this line to enable helpful debug messages on Serial
36+
37+
myGNSS.setPacketCfgPayloadSize(UBX_NAV_SAT_MAX_LEN); // Allocate extra RAM to store the full NAV SAT data
38+
39+
if (myGNSS.begin() == false) //Connect to the u-blox module using Wire port
40+
{
41+
Serial.println(F("u-blox GNSS not detected at default I2C address. Please check wiring. Freezing."));
42+
while (1);
43+
}
44+
45+
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
46+
myGNSS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
47+
48+
myGNSS.setNavigationFrequency(1); //Produce one solution per second
49+
}
50+
51+
void loop()
52+
{
53+
if (myGNSS.getNAVSAT()) // Poll the latest NAV SAT data
54+
{
55+
Serial.println();
56+
57+
// See u-blox_structs.h for the full definition of UBX_NAV_SAT_data_t
58+
Serial.print(F("New NAV SAT data received. It contains data for "));
59+
Serial.print(myGNSS.packetUBXNAVSAT->data.header.numSvs);
60+
if (myGNSS.packetUBXNAVSAT->data.header.numSvs == 1)
61+
Serial.println(F(" SV."));
62+
else
63+
Serial.println(F(" SVs."));
64+
65+
// Just for giggles, print the signal strength for each SV as a barchart
66+
for (uint16_t block = 0; block < myGNSS.packetUBXNAVSAT->data.header.numSvs; block++) // For each SV
67+
{
68+
switch (myGNSS.packetUBXNAVSAT->data.blocks[block].gnssId) // Print the GNSS ID
69+
{
70+
case 0:
71+
Serial.print(F("GPS "));
72+
break;
73+
case 1:
74+
Serial.print(F("SBAS "));
75+
break;
76+
case 2:
77+
Serial.print(F("Galileo "));
78+
break;
79+
case 3:
80+
Serial.print(F("BeiDou "));
81+
break;
82+
case 4:
83+
Serial.print(F("IMES "));
84+
break;
85+
case 5:
86+
Serial.print(F("QZSS "));
87+
break;
88+
case 6:
89+
Serial.print(F("GLONASS "));
90+
break;
91+
default:
92+
Serial.print(F("UNKNOWN "));
93+
break;
94+
}
95+
96+
Serial.print(myGNSS.packetUBXNAVSAT->data.blocks[block].svId); // Print the SV ID
97+
98+
if (myGNSS.packetUBXNAVSAT->data.blocks[block].svId < 10) Serial.print(F(" "));
99+
else if (myGNSS.packetUBXNAVSAT->data.blocks[block].svId < 100) Serial.print(F(" "));
100+
else Serial.print(F(" "));
101+
102+
// Print the signal strength as a bar chart
103+
for (uint8_t cno = 0; cno < myGNSS.packetUBXNAVSAT->data.blocks[block].cno; cno++)
104+
Serial.print(F("="));
105+
106+
Serial.println();
107+
}
108+
}
109+
}

examples/Dead_Reckoning/Example4_vehicleDynamics/Example4_vehicleDynamics.ino

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
1515
Open the serial monitor at 115200 baud to see the output
1616
17-
After calibrating the module and securing it to your vehicle such that it's
18-
stable within 2 degrees, and the board is oriented correctly with regards to
19-
the vehicle's frame, you can now read the vehicle's "attitude". The attitude
20-
includes the vehicle's heading, pitch, and roll. You can also check the
21-
accuracy of those readings.
22-
17+
getEsfAlignment (UBX-ESF-ALG) reports the status and alignment angles of the IMU within the vehicle.
18+
These define the rotation of the IMU frame within the vehicle (installation frame) - not the heading
19+
of the vehicle itself. The vehicle attitude solution is reported separately by getNAVATT (UBX-NAV-ATT).
2320
*/
2421

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

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

44+
myGNSS.setESFAutoAlignment(true); //Enable Automatic IMU-mount Alignment
45+
4746
if (myGNSS.getEsfInfo()){
4847

4948
Serial.print(F("Fusion Mode: "));
@@ -64,19 +63,31 @@ void loop()
6463
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
6564
if (myGNSS.getEsfAlignment()) // Poll new ESF ALG data
6665
{
67-
Serial.print(F("Status: "));
68-
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.status);
66+
Serial.print(F("IMU-Mount Alignment: On/Off: "));
67+
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.autoMntAlgOn);
68+
Serial.print(F(" Status: "));
69+
Serial.print(myGNSS.packetUBXESFALG->data.flags.bits.status);
6970
Serial.print(F(" Roll: "));
7071
Serial.print(myGNSS.getESFroll(), 2); // Use the helper function to get the roll in degrees
7172
Serial.print(F(" Pitch: "));
7273
Serial.print(myGNSS.getESFpitch(), 2); // Use the helper function to get the pitch in degrees
73-
Serial.print(F(" Heading: "));
74+
Serial.print(F(" Yaw: "));
7475
Serial.print(myGNSS.getESFyaw(), 2); // Use the helper function to get the yaw in degrees
7576
Serial.print(F(" Errors: "));
7677
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.tiltAlgError);
7778
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.yawAlgError);
7879
Serial.println(myGNSS.packetUBXESFALG->data.error.bits.angleError);
7980
}
8081

82+
if (myGNSS.getNAVATT()) // Poll new NAV ATT data
83+
{
84+
Serial.print(F("Vehicle Attitude: Roll: "));
85+
Serial.print(myGNSS.getATTroll(), 2); // Use the helper function to get the roll in degrees
86+
Serial.print(F(" Pitch: "));
87+
Serial.print(myGNSS.getATTpitch(), 2); // Use the helper function to get the pitch in degrees
88+
Serial.print(F(" Heading: "));
89+
Serial.println(myGNSS.getATTheading(), 2); // Use the helper function to get the heading in degrees
90+
}
91+
8192
delay(250);
8293
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SparkFun u-blox GNSS v3
2-
version=3.0.15
2+
version=3.0.16
33
author=SparkFun Electronics <[email protected]>
44
maintainer=SparkFun Electronics <sparkfun.com>
55
sentence=Library for I2C, Serial and SPI Communication with u-blox GNSS modules<br/><br/>

src/u-blox_structs.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,20 @@ typedef struct
432432
struct
433433
{
434434
uint8_t invalidLlh : 1; // 1 = Invalid lon, lat, height and hMSL
435+
uint8_t lastCorrectionAge : 4; // Age of the most recently received differential correction:
436+
// 0: Not available
437+
// 1: Age between 0 and 1 second
438+
// 2: Age between 1 (inclusive) and 2 seconds
439+
// 3: Age between 2 (inclusive) and 5 seconds
440+
// 4: Age between 5 (inclusive) and 10 seconds
441+
// 5: Age between 10 (inclusive) and 15 seconds
442+
// 6: Age between 15 (inclusive) and 20 seconds
443+
// 7: Age between 20 (inclusive) and 30 seconds
444+
// 8: Age between 30 (inclusive) and 45 seconds
445+
// 9: Age between 45 (inclusive) and 60 seconds
446+
// 10: Age between 60 (inclusive) and 90 seconds
447+
// 11: Age between 90 (inclusive) and 120 seconds
448+
// >=12: Age greater or equal than 120 seconds
435449
} bits;
436450
} flags3;
437451
uint8_t reserved1[5];

0 commit comments

Comments
 (0)