Initial commit - based on v2_candidate

This commit is contained in:
PaulZC
2021-01-09 06:44:12 +00:00
commit 6627841e7d
89 changed files with 31927 additions and 0 deletions
@@ -0,0 +1,75 @@
/*
By: Elias Santistevan
SparkFun Electronics
Date: May, 2020
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
Feel like supporting open source hardware?
Buy a board from SparkFun!
NEO-M8U: https://www.sparkfun.com/products/16329
ZED-F9R: https://www.sparkfun.com/products/16344
Hardware Connections:
Plug a Qwiic cable into the GNSS and a Redboard Qwiic
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
To take advantage of the internal IMU of either the Dead Reckoning GNSS
boards (ZED-F9R, NEO-M8U), you must first calibrate it. This includes securing the GNSS module
to your vehicle so that it is stable within 2 degrees and that the frame of
reference of the board is consistent with the picture outlined in the
Receiver-Description-Prot-Spec Datasheet under Automotive/Untethered Dead
Reckoning. You may also check either the ZED-F9R or NEO-M8U Hookup Guide for
more information. After the board is secure, you'll need to put the module
through certain conditions for proper calibration: acceleration, turning,
stopping for a few minutes, getting to a speed over 30km/h all under a clear sky
with good GNSS signal. This example simply looks at the
"fusionMode" status which indicates whether the SparkFun Dead Reckoning is
initializing - 0, calibrated - 1, or if an error has occurred - 2,3.
*/
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun u-blox Example"));
Wire.begin();
if (myGPS.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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
//myGPS.resetIMUalignment(); // Uncomment this line to reset the IMU alignment
}
void loop()
{
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
if (myGPS.getEsfInfo()) // Poll new ESF STATUS data
{
Serial.print(F("Fusion Mode: "));
Serial.print(myGPS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 0)
Serial.println(F(" Sensor is initializing..."));
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1)
Serial.println(F(" Sensor is calibrated!"));
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 2)
Serial.println(F(" Sensor fusion is suspended!"));
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 3)
Serial.println(F(" Sensor fusion is disabled!"));
}
delay(250);
}
@@ -0,0 +1,91 @@
/*
By: Elias Santistevan
SparkFun Electronics
Date: May, 2020
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
Feel like supporting open source hardware?
Buy a board from SparkFun!
NEO-M8U: https://www.sparkfun.com/products/16329
ZED-F9R: https://www.sparkfun.com/products/16344
Hardware Connections:
Plug a Qwiic cable into the GNSS and a Redboard Qwiic
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
After calibrating the module, also known as "Fusion Mode", you can get
data directly from the IMU. This data is integrated directly into the GNSS
output, but is provided by the module as well.
*/
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun u-blox Example"));
Wire.begin();
if (myGPS.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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
if (myGPS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
Serial.println(F("Fusion Mode is either disabled or not initialized!"));
Serial.println(F("Please see the previous example for more information."));
}
}
}
void loop()
{
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
if (myGPS.getEsfIns()) // Poll new ESF INS data
{
Serial.print(F("X Ang Rate: "));
Serial.print(myGPS.packetUBXESFINS->data.xAngRate);
Serial.print(F(" Y Ang Rate: "));
Serial.print(myGPS.packetUBXESFINS->data.yAngRate);
Serial.print(F(" Z Ang Rate: "));
Serial.print(myGPS.packetUBXESFINS->data.zAngRate);
Serial.print(F(" X Accel: "));
Serial.print(myGPS.packetUBXESFINS->data.xAccel);
Serial.print(F(" Y Accel: "));
Serial.print(myGPS.packetUBXESFINS->data.yAccel);
Serial.print(F(" Z Accel: "));
Serial.print(myGPS.packetUBXESFINS->data.zAccel);
// These values also have "validity checks" that can be provided by the
// ublox library by reading bitfield0
Serial.print(F(" Validity: "));
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.xAngRateValid);
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.yAngRateValid);
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.zAngRateValid);
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.xAccelValid);
Serial.print(myGPS.packetUBXESFINS->data.bitfield0.bits.yAccelValid);
Serial.println(myGPS.packetUBXESFINS->data.bitfield0.bits.zAccelValid);
}
delay(250);
}
@@ -0,0 +1,125 @@
/*
By: Elias Santistevan
SparkFun Electronics
Date: May, 2020
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
Feel like supporting open source hardware?
Buy a board from SparkFun!
NEO-M8U: https://www.sparkfun.com/products/16329
ZED-F9R: https://www.sparkfun.com/products/16344
Hardware Connections:
Plug a Qwiic cable into the GNSS and a Redboard Qwiic
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
After calibrating the module, also known as "Fusion Mode", you can get
data directly from the IMU. This example code walks you through trouble
shooting or identifying the different states of any individual
"external" (which include internal) sensors you've hooked up (vehicle speed
sensor) or the internal IMU used by the modules. You can see if the sensor is
being used, if it's calibrated, ready, what data type it returns, the state
of the measurement etc.
*/
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun u-blox Example"));
Wire.begin();
if (myGPS.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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
// GetEsfInfo also gets the number of sensors used by the ublox module, this
// includes (in the case of the ZED-F9R) wheel tick input from the vehicle
// speed sensor attached to the module.
if (myGPS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
Serial.println(F("Fusion Mode is either disabled or not initialized!"));
Serial.println(F("Please see the previous example for more information."));
}
}
}
void loop()
{
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
if (myGPS.getEsfInfo()) // Poll new ESF STATUS data
{
UBX_ESF_STATUS_sensorStatus_t sensorStatus; // Create storage for the individual sensor status
//See ublox receiver description or our hookup guide for information on the return values
Serial.println(F(" "));
Serial.println(F(" C "));
Serial.println(F(" a "));
Serial.println(F(" l "));
Serial.println(F(" i "));
Serial.println(F(" b M "));
Serial.println(F(" r i N"));
Serial.println(F(" a B s o"));
Serial.println(F(" S t T B a s i"));
Serial.println(F("S e B i i a d e s"));
Serial.println(F("e n e o m d d y"));
Serial.println(F("n s i I n e T "));
Serial.println(F("s o n s M i M M"));
Serial.println(F("o r g S S e m e e"));
Serial.println(F("r R t t a e a a"));
Serial.println(F(" T U e a a s s s"));
Serial.println(F("N y s a t t u T u u"));
Serial.println(F("o p e d u u r a r r"));
Serial.println(F(". e d y s s e g e e"));
Serial.println(F(" "));
for(uint8_t i = 0; i < myGPS.packetUBXESFSTATUS->data.numSens; i++)
{
myGPS.getSensorFusionStatus(&sensorStatus, i); // Extract the individual sensor data for this sensor
Serial.print(i); Serial.print(F(" ")); // Print the sensor number
// Print the sensor type
Serial.print(sensorStatus.sensStatus1.bits.type);
if (sensorStatus.sensStatus1.bits.type < 10) Serial.print(F(" "));
Serial.print(F(" "));
Serial.print(sensorStatus.sensStatus1.bits.used); Serial.print(F(" ")); // Print the used flag
Serial.print(sensorStatus.sensStatus1.bits.ready); Serial.print(F(" ")); // Print the ready flag
Serial.print(sensorStatus.sensStatus2.bits.calibStatus); Serial.print(F(" ")); // Print the calibration status
Serial.print(sensorStatus.sensStatus2.bits.timeStatus); Serial.print(F(" ")); // Print the time status
Serial.print(sensorStatus.faults.bits.badMeas); Serial.print(F(" ")); // Print the bad measurement flag
Serial.print(sensorStatus.faults.bits.badTTag); Serial.print(F(" ")); // Print the time tag flag
Serial.print(sensorStatus.faults.bits.missingMeas); Serial.print(F(" ")); // Print the missing measurement flag
Serial.print(sensorStatus.faults.bits.noisyMeas); // Print the noisy measure flag
Serial.println();
}
}
delay(250);
}
@@ -0,0 +1,83 @@
/*
By: Elias Santistevan
SparkFun Electronics
Date: May, 2020
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
Feel like supporting open source hardware?
Buy a board from SparkFun!
NEO-M8U: https://www.sparkfun.com/products/16329
ZED-F9R: https://www.sparkfun.com/products/16344
Hardware Connections:
Plug a Qwiic cable into the GNSS and a Redboard Qwiic
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
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.
*/
#include <Wire.h> //Needed for I2C to GNSS
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun u-blox Example"));
Wire.begin();
if (myGPS.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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
if (myGPS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
Serial.println(F("Fusion Mode is either disabled or not initialized!"));
Serial.println(F("Please see the previous example for more information."));
}
}
}
void loop()
{
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
if (myGPS.getEsfAlignment()) // Poll new ESF ALG data
{
Serial.print(F("Status: "));
Serial.print(myGPS.packetUBXESFALG->data.flags.bits.status);
Serial.print(F(" Roll: "));
Serial.print(myGPS.getESFroll(), 2); // Use the helper function to get the roll in degrees
Serial.print(F(" Pitch: "));
Serial.print(myGPS.getESFpitch(), 2); // Use the helper function to get the pitch in degrees
Serial.print(F(" Heading: "));
Serial.print(myGPS.getESFyaw(), 2); // Use the helper function to get the yaw in degrees
Serial.print(F(" Errors: "));
Serial.print(myGPS.packetUBXESFALG->data.error.bits.tiltAlgError);
Serial.print(myGPS.packetUBXESFALG->data.error.bits.yawAlgError);
Serial.println(myGPS.packetUBXESFALG->data.error.bits.angleError);
}
delay(250);
}
@@ -0,0 +1,94 @@
/*
By: Paul Clark
SparkFun Electronics
Date: December, 2020
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
This example configures the High Navigation Rate on the NEO-M8U and then
polls and displays the attitude solution, vehicle dynamics information
and high rate position, velocity and time.
This example polls the high rate data.
(The next example uses "autoHNR" to receive the HNR data automatically.)
Please make sure your NEO-M8U is running UDR firmware >= 1.31. Please update using u-center if necessary:
https://www.u-blox.com/en/product/neo-m8u-module#tab-documentation-resources
Feel like supporting open source hardware?
Buy a board from SparkFun!
NEO-M8U: https://www.sparkfun.com/products/16329
Hardware Connections:
Plug a Qwiic cable into the GPS and a Redboard Qwiic
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_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun u-blox Example"));
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
{
Serial.println(F("Warning! u-blox GPS did not begin correctly."));
Serial.println(F("(This may be because the I2C port is busy with HNR messages.)"));
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
if (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
Serial.println(F("setHNRNavigationRate was successful"));
else
Serial.println(F("setHNRNavigationRate was NOT successful"));
myGPS.setAutoHNRATT(false); //Make sure auto HNR attitude messages are disabled
myGPS.setAutoHNRINS(false); //Make sure auto HNR vehicle dynamics messages are disabled
myGPS.setAutoHNRPVT(false); //Make sure auto HNR PVT messages are disabled
}
void loop()
{
// Poll and print selected HNR data
if (myGPS.getHNRAtt(125) == true) // Request HNR Att data using a 125ms timeout
{
Serial.print(F("Roll: "));
Serial.print(myGPS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
Serial.print(F(" Pitch: "));
Serial.print(myGPS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
Serial.print(F(" Heading: "));
Serial.println(myGPS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
}
if (myGPS.getHNRDyn(125) == true) // Request HNR Dyn data using a 125ms timeout
{
Serial.print(F("xAccel: "));
Serial.print(myGPS.packetUBXHNRINS->data.xAccel);
Serial.print(F(" yAccel: "));
Serial.print(myGPS.packetUBXHNRINS->data.yAccel);
Serial.print(F(" zAccel: "));
Serial.println(myGPS.packetUBXHNRINS->data.zAccel);
}
if (myGPS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
{
Serial.print(F("ns: "));
Serial.print(myGPS.packetUBXHNRPVT->data.nano);
Serial.print(F(" Lat: "));
Serial.print(myGPS.packetUBXHNRPVT->data.lat);
Serial.print(F(" Lon: "));
Serial.println(myGPS.packetUBXHNRPVT->data.lon);
}
}
@@ -0,0 +1,107 @@
/*
By: Paul Clark
SparkFun Electronics
Date: December, 2020
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
This example configures the High Navigation Rate on the NEO-M8U and then
reads and displays the attitude solution, vehicle dynamics information
and high rate position, velocity and time.
This example uses "autoHNR" to receive the HNR data automatically.
Please make sure your NEO-M8U is running UDR firmware >= 1.31. Please update using u-center if necessary:
https://www.u-blox.com/en/product/neo-m8u-module#tab-documentation-resources
Feel like supporting open source hardware?
Buy a board from SparkFun!
NEO-M8U: https://www.sparkfun.com/products/16329
Hardware Connections:
Plug a Qwiic cable into the GPS and a Redboard Qwiic
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_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GPS myGPS;
boolean usingAutoHNRAtt = false;
boolean usingAutoHNRDyn = false;
boolean usingAutoHNRPVT = false;
void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun u-blox Example"));
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
{
Serial.println(F("Warning! u-blox GPS did not begin correctly."));
Serial.println(F("(This may be because the I2C port is busy with HNR messages.)"));
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGPS.saveConfigSelective(VAL_CFG_SUBSEC_IOPORT); //Save (only) the communications port settings to flash and BBR
if (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
Serial.println(F("setHNRNavigationRate was successful"));
else
Serial.println(F("setHNRNavigationRate was NOT successful"));
usingAutoHNRAtt = myGPS.setAutoHNRATT(true); //Attempt to enable auto HNR attitude messages
if (usingAutoHNRAtt)
Serial.println(F("AutoHNRATT successful"));
usingAutoHNRDyn = myGPS.setAutoHNRINS(true); //Attempt to enable auto HNR vehicle dynamics messages
if (usingAutoHNRDyn)
Serial.println(F("AutoHNRINS successful"));
usingAutoHNRPVT = myGPS.setAutoHNRPVT(true); //Attempt to enable auto HNR PVT messages
if (usingAutoHNRPVT)
Serial.println(F("AutoHNRPVT successful"));
}
void loop()
{
if (usingAutoHNRAtt && (myGPS.getHNRAtt() == true)) // If setAutoHNRAtt was successful and new data is available
{
Serial.print(F("Roll: ")); // Print selected data
Serial.print(myGPS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
Serial.print(F(" Pitch: "));
Serial.print(myGPS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
Serial.print(F(" Heading: "));
Serial.println(myGPS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
myGPS.flushHNRATT(); // Mark data as stale
}
if (usingAutoHNRDyn && (myGPS.getHNRDyn() == true)) // If setAutoHNRDyn was successful and new data is available
{
Serial.print(F("xAccel: ")); // Print selected data
Serial.print(myGPS.packetUBXHNRINS->data.xAccel);
Serial.print(F(" yAccel: "));
Serial.print(myGPS.packetUBXHNRINS->data.yAccel);
Serial.print(F(" zAccel: "));
Serial.println(myGPS.packetUBXHNRINS->data.zAccel);
myGPS.flushHNRINS(); // Mark data as stale
}
if (usingAutoHNRPVT && (myGPS.getHNRPVT() == true)) // If setAutoHNRPVT was successful and new data is available
{
Serial.print(F("ns: ")); // Print selected data
Serial.print(myGPS.packetUBXHNRPVT->data.nano);
Serial.print(F(" Lat: "));
Serial.print(myGPS.packetUBXHNRPVT->data.lat);
Serial.print(F(" Lon: "));
Serial.println(myGPS.packetUBXHNRPVT->data.lon);
myGPS.flushHNRPVT(); // Mark data as stale
}
}