first commit
This commit is contained in:
commit
e6a42e28e9
4355 changed files with 4626605 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_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
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.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 (myGNSS.getEsfInfo()) // Poll new ESF STATUS data
|
||||
{
|
||||
Serial.print(F("Fusion Mode: "));
|
||||
Serial.print(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 0)
|
||||
Serial.println(F(" Sensor is initializing..."));
|
||||
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1)
|
||||
Serial.println(F(" Sensor is calibrated!"));
|
||||
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 2)
|
||||
Serial.println(F(" Sensor fusion is suspended!"));
|
||||
else if (myGNSS.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_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
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)
|
||||
|
||||
if (myGNSS.getEsfInfo()){
|
||||
|
||||
Serial.print(F("Fusion Mode: "));
|
||||
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||
|
||||
if (myGNSS.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 (myGNSS.getEsfIns()) // Poll new ESF INS data
|
||||
{
|
||||
Serial.print(F("X Ang Rate: "));
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.xAngRate);
|
||||
Serial.print(F(" Y Ang Rate: "));
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.yAngRate);
|
||||
Serial.print(F(" Z Ang Rate: "));
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.zAngRate);
|
||||
Serial.print(F(" X Accel: "));
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.xAccel);
|
||||
Serial.print(F(" Y Accel: "));
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.yAccel);
|
||||
Serial.print(F(" Z Accel: "));
|
||||
Serial.print(myGNSS.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(myGNSS.packetUBXESFINS->data.bitfield0.bits.xAngRateValid);
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.yAngRateValid);
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.zAngRateValid);
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.xAccelValid);
|
||||
Serial.print(myGNSS.packetUBXESFINS->data.bitfield0.bits.yAccelValid);
|
||||
Serial.println(myGNSS.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_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
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)
|
||||
|
||||
// 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 (myGNSS.getEsfInfo()){
|
||||
|
||||
Serial.print(F("Fusion Mode: "));
|
||||
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||
|
||||
if (myGNSS.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 (myGNSS.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 < myGNSS.packetUBXESFSTATUS->data.numSens; i++)
|
||||
{
|
||||
myGNSS.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,95 @@
|
|||
/*
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
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.setESFAutoAlignment(true); //Enable Automatic IMU-mount Alignment
|
||||
|
||||
if (myGNSS.getEsfInfo()){
|
||||
|
||||
Serial.print(F("Fusion Mode: "));
|
||||
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||
|
||||
if (myGNSS.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 (myGNSS.getEsfAlignment()) // Poll new ESF ALG data
|
||||
{
|
||||
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(" 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);
|
||||
}
|
||||
|
|
@ -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_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||
|
||||
if (myGNSS.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.)"));
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if (myGNSS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
|
||||
Serial.println(F("setHNRNavigationRate was successful"));
|
||||
else
|
||||
Serial.println(F("setHNRNavigationRate was NOT successful"));
|
||||
|
||||
myGNSS.setAutoHNRATT(false); //Make sure auto HNR attitude messages are disabled
|
||||
myGNSS.setAutoHNRINS(false); //Make sure auto HNR vehicle dynamics messages are disabled
|
||||
myGNSS.setAutoHNRPVT(false); //Make sure auto HNR PVT messages are disabled
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// Poll and print selected HNR data
|
||||
if (myGNSS.getHNRAtt(125) == true) // Request HNR Att data using a 125ms timeout
|
||||
{
|
||||
Serial.print(F("Roll: "));
|
||||
Serial.print(myGNSS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
||||
Serial.print(F(" Pitch: "));
|
||||
Serial.print(myGNSS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
||||
Serial.print(F(" Heading: "));
|
||||
Serial.println(myGNSS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
||||
}
|
||||
if (myGNSS.getHNRDyn(125) == true) // Request HNR Dyn data using a 125ms timeout
|
||||
{
|
||||
Serial.print(F("xAccel: "));
|
||||
Serial.print(myGNSS.packetUBXHNRINS->data.xAccel);
|
||||
Serial.print(F(" yAccel: "));
|
||||
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
|
||||
Serial.print(F(" zAccel: "));
|
||||
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
|
||||
}
|
||||
if (myGNSS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
|
||||
{
|
||||
Serial.print(F("ns: "));
|
||||
Serial.print(myGNSS.packetUBXHNRPVT->data.nano);
|
||||
Serial.print(F(" Lat: "));
|
||||
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
|
||||
Serial.print(F(" Lon: "));
|
||||
Serial.println(myGNSS.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_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
bool usingAutoHNRAtt = false;
|
||||
bool usingAutoHNRDyn = false;
|
||||
bool usingAutoHNRPVT = false;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||
|
||||
if (myGNSS.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.)"));
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
if (myGNSS.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 = myGNSS.setAutoHNRATT(true); //Attempt to enable auto HNR attitude messages
|
||||
if (usingAutoHNRAtt)
|
||||
Serial.println(F("AutoHNRATT successful"));
|
||||
|
||||
usingAutoHNRDyn = myGNSS.setAutoHNRINS(true); //Attempt to enable auto HNR vehicle dynamics messages
|
||||
if (usingAutoHNRDyn)
|
||||
Serial.println(F("AutoHNRINS successful"));
|
||||
|
||||
usingAutoHNRPVT = myGNSS.setAutoHNRPVT(true); //Attempt to enable auto HNR PVT messages
|
||||
if (usingAutoHNRPVT)
|
||||
Serial.println(F("AutoHNRPVT successful"));
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
if (usingAutoHNRAtt && (myGNSS.getHNRAtt() == true)) // If setAutoHNRAtt was successful and new data is available
|
||||
{
|
||||
Serial.print(F("Roll: ")); // Print selected data
|
||||
Serial.print(myGNSS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
||||
Serial.print(F(" Pitch: "));
|
||||
Serial.print(myGNSS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
||||
Serial.print(F(" Heading: "));
|
||||
Serial.println(myGNSS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
||||
myGNSS.flushHNRATT(); // Mark data as stale
|
||||
}
|
||||
if (usingAutoHNRDyn && (myGNSS.getHNRDyn() == true)) // If setAutoHNRDyn was successful and new data is available
|
||||
{
|
||||
Serial.print(F("xAccel: ")); // Print selected data
|
||||
Serial.print(myGNSS.packetUBXHNRINS->data.xAccel);
|
||||
Serial.print(F(" yAccel: "));
|
||||
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
|
||||
Serial.print(F(" zAccel: "));
|
||||
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
|
||||
myGNSS.flushHNRINS(); // Mark data as stale
|
||||
}
|
||||
if (usingAutoHNRPVT && (myGNSS.getHNRPVT() == true)) // If setAutoHNRPVT was successful and new data is available
|
||||
{
|
||||
Serial.print(F("ns: ")); // Print selected data
|
||||
Serial.print(myGNSS.packetUBXHNRPVT->data.nano);
|
||||
Serial.print(F(" Lat: "));
|
||||
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
|
||||
Serial.print(F(" Lon: "));
|
||||
Serial.println(myGNSS.packetUBXHNRPVT->data.lon);
|
||||
myGNSS.flushHNRPVT(); // Mark data as stale
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
/*
|
||||
By: Nathan Seidle
|
||||
SparkFun Electronics
|
||||
Date: August, 2021
|
||||
License: MIT. See license file for more information but you can
|
||||
basically do whatever you want with this code.
|
||||
|
||||
This example configures the AutoAlignment option for the IMU.
|
||||
The ZED-F9R Integration guide recommends enabling Auto Alignment once
|
||||
the device has been attached to the vehicle's frame.
|
||||
Enabling auto-alignment will cause the the sensor fusion status
|
||||
to begin initialization. After driving around a few turns, the sensors
|
||||
should enter 'Calibrated' state. See example 1 for fusion state or
|
||||
monitor UBX-ESF-STATUS.
|
||||
|
||||
As of writing the ZED-F9R is using HPS v1.2 firmware. Please update using u-center if necessary.
|
||||
|
||||
Feel like supporting open source hardware?
|
||||
Buy a board from SparkFun!
|
||||
ZED-F9R: https://www.sparkfun.com/products/16344
|
||||
ZED-F9R pHat: https://www.sparkfun.com/products/16475
|
||||
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/17912)
|
||||
Open the serial monitor at 115200 baud to see the output
|
||||
|
||||
*/
|
||||
|
||||
#include <Wire.h> //Needed for I2C to GPS
|
||||
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
|
||||
|
||||
if (myGNSS.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.)"));
|
||||
}
|
||||
|
||||
bool esfAutoAlignment = myGNSS.getESFAutoAlignment();
|
||||
Serial.print(F("esfAutoAlignment: "));
|
||||
if (esfAutoAlignment == true)
|
||||
Serial.println(F("True"));
|
||||
else
|
||||
Serial.println(F("False"));
|
||||
|
||||
myGNSS.setESFAutoAlignment(true); //Enable UBX-CFG-ESFALG Automatic IMU-mount Alignment
|
||||
|
||||
myGNSS.setAutoHNRATT(false); //Make sure auto HNR attitude messages are disabled
|
||||
myGNSS.setAutoHNRINS(false); //Make sure auto HNR vehicle dynamics messages are disabled
|
||||
myGNSS.setAutoHNRPVT(false); //Make sure auto HNR PVT messages are disabled
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
|
||||
if (myGNSS.getEsfInfo()) // Poll new ESF STATUS data
|
||||
{
|
||||
Serial.print(F("Fusion Mode: "));
|
||||
Serial.print(myGNSS.packetUBXESFSTATUS->data.fusionMode);
|
||||
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 0)
|
||||
Serial.println(F(" Sensor is initializing..."));
|
||||
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1)
|
||||
Serial.println(F(" Sensor is calibrated!"));
|
||||
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 2)
|
||||
Serial.println(F(" Sensor fusion is suspended!"));
|
||||
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 3)
|
||||
Serial.println(F(" Sensor fusion is disabled!"));
|
||||
}
|
||||
|
||||
// Poll and print selected HNR data
|
||||
if (myGNSS.getHNRAtt(125) == true) // Request HNR Att data using a 125ms timeout
|
||||
{
|
||||
Serial.print(F("Roll: "));
|
||||
Serial.print(myGNSS.getHNRroll(), 2); // Use the helper function to get the roll in degrees
|
||||
Serial.print(F(" Pitch: "));
|
||||
Serial.print(myGNSS.getHNRpitch(), 2); // Use the helper function to get the pitch in degrees
|
||||
Serial.print(F(" Heading: "));
|
||||
Serial.println(myGNSS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
|
||||
}
|
||||
if (myGNSS.getHNRDyn(125) == true) // Request HNR Dyn data using a 125ms timeout
|
||||
{
|
||||
Serial.print(F("xAccel: "));
|
||||
Serial.print(myGNSS.packetUBXHNRINS->data.xAccel);
|
||||
Serial.print(F(" yAccel: "));
|
||||
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
|
||||
Serial.print(F(" zAccel: "));
|
||||
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
|
||||
}
|
||||
if (myGNSS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
|
||||
{
|
||||
Serial.print(F("ns: "));
|
||||
Serial.print(myGNSS.packetUBXHNRPVT->data.nano);
|
||||
Serial.print(F(" Lat: "));
|
||||
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
|
||||
Serial.print(F(" Lon: "));
|
||||
Serial.println(myGNSS.packetUBXHNRPVT->data.lon);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
By: Paul CLark
|
||||
SparkFun Electronics
|
||||
Date: January, 2022
|
||||
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!
|
||||
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.
|
||||
|
||||
*/
|
||||
|
||||
#include <Wire.h> //Needed for I2C to GNSS
|
||||
|
||||
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
|
||||
SFE_UBLOX_GNSS myGNSS;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); //Wait for user to open terminal
|
||||
Serial.println(F("SparkFun u-blox Example"));
|
||||
|
||||
Wire.begin();
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// PVAT data is produced at the navigation rate, so by default we'll get fresh data once per second
|
||||
if (myGNSS.getNAVPVAT()) // Poll new PVAT
|
||||
{
|
||||
Serial.print(F("Roll: "));
|
||||
Serial.print((float)myGNSS.getVehicleRoll() / 100000.0, 5); // Use the helper function to get the roll in degrees * 10^-5
|
||||
|
||||
Serial.print(F(" Pitch: "));
|
||||
Serial.print((float)myGNSS.getVehiclePitch() / 100000.0, 5); // Use the helper function to get the pitch in degrees * 10^-5
|
||||
|
||||
Serial.print(F(" Heading: "));
|
||||
Serial.print((float)myGNSS.getVehicleHeading() / 100000.0, 5); // Use the helper function to get the heading in degrees * 10^-5
|
||||
|
||||
// We don't have helper functions to extract the roll, pitch and heading valid flags from the PVAT message. But we can do it manually:
|
||||
|
||||
Serial.print(F(" Roll Valid: "));
|
||||
Serial.print(myGNSS.packetUBXNAVPVAT->data.flags.bits.vehRollValid);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.vehRollValid = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
Serial.print(F(" Pitch Valid: "));
|
||||
Serial.print(myGNSS.packetUBXNAVPVAT->data.flags.bits.vehPitchValid);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.vehPitchValid = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
Serial.print(F(" Heading Valid: "));
|
||||
Serial.print(myGNSS.packetUBXNAVPVAT->data.flags.bits.vehHeadingValid);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.vehHeadingValid = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
// We don't have helper functions to extract the roll, pitch and heading accuracy from the PVAT message. But we can do it manually:
|
||||
|
||||
Serial.print(F(" Roll Acc: "));
|
||||
Serial.print(((float)myGNSS.packetUBXNAVPVAT->data.accRoll) / 100, 2);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.accRoll = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
Serial.print(F(" Pitch Acc: "));
|
||||
Serial.print(((float)myGNSS.packetUBXNAVPVAT->data.accPitch) / 100, 2);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.accPitch = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
Serial.print(F(" Heading Acc: "));
|
||||
Serial.print(((float)myGNSS.packetUBXNAVPVAT->data.accHeading) / 100, 2);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried2.bits.accHeading = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
// We don't have helper functions to extract the lat and lon from the PVAT message. But we can do it manually:
|
||||
|
||||
Serial.print(F(" Lat: "));
|
||||
Serial.print(((float)myGNSS.packetUBXNAVPVAT->data.lat) / 10000000.0, 7);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.lat = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
Serial.print(F(" Lon: "));
|
||||
Serial.print(((float)myGNSS.packetUBXNAVPVAT->data.lon) / 10000000.0, 7);
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.lon = false; // Mark the data as stale
|
||||
myGNSS.packetUBXNAVPVAT->moduleQueried.moduleQueried1.bits.all = false;
|
||||
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
delay(250);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue