Updating examples: change class name & update header file

This commit is contained in:
PaulZC
2021-01-09 08:18:31 +00:00
parent 2d0307f3b3
commit 627fc27700
62 changed files with 856 additions and 856 deletions
@@ -32,8 +32,8 @@
#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;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -43,31 +43,31 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.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
//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 (myGPS.getEsfInfo()) // Poll new ESF STATUS data
if (myGNSS.getEsfInfo()) // Poll new ESF STATUS data
{
Serial.print(F("Fusion Mode: "));
Serial.print(myGPS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 0)
Serial.print(myGNSS.packetUBXESFSTATUS->data.fusionMode);
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 0)
Serial.println(F(" Sensor is initializing..."));
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1)
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1)
Serial.println(F(" Sensor is calibrated!"));
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 2)
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 2)
Serial.println(F(" Sensor fusion is suspended!"));
else if (myGPS.packetUBXESFSTATUS->data.fusionMode == 3)
else if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 3)
Serial.println(F(" Sensor fusion is disabled!"));
}
@@ -24,8 +24,8 @@
#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;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -35,20 +35,20 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
if (myGPS.getEsfInfo()){
if (myGNSS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
@@ -61,30 +61,30 @@ void setup()
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
if (myGNSS.getEsfIns()) // Poll new ESF INS data
{
Serial.print(F("X Ang Rate: "));
Serial.print(myGPS.packetUBXESFINS->data.xAngRate);
Serial.print(myGNSS.packetUBXESFINS->data.xAngRate);
Serial.print(F(" Y Ang Rate: "));
Serial.print(myGPS.packetUBXESFINS->data.yAngRate);
Serial.print(myGNSS.packetUBXESFINS->data.yAngRate);
Serial.print(F(" Z Ang Rate: "));
Serial.print(myGPS.packetUBXESFINS->data.zAngRate);
Serial.print(myGNSS.packetUBXESFINS->data.zAngRate);
Serial.print(F(" X Accel: "));
Serial.print(myGPS.packetUBXESFINS->data.xAccel);
Serial.print(myGNSS.packetUBXESFINS->data.xAccel);
Serial.print(F(" Y Accel: "));
Serial.print(myGPS.packetUBXESFINS->data.yAccel);
Serial.print(myGNSS.packetUBXESFINS->data.yAccel);
Serial.print(F(" Z Accel: "));
Serial.print(myGPS.packetUBXESFINS->data.zAccel);
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(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);
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);
@@ -28,8 +28,8 @@
#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;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -39,23 +39,23 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
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 (myGPS.getEsfInfo()){
if (myGNSS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
@@ -68,7 +68,7 @@ void setup()
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
if (myGNSS.getEsfInfo()) // Poll new ESF STATUS data
{
UBX_ESF_STATUS_sensorStatus_t sensorStatus; // Create storage for the individual sensor status
@@ -95,9 +95,9 @@ void loop()
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++)
for(uint8_t i = 0; i < myGNSS.packetUBXESFSTATUS->data.numSens; i++)
{
myGPS.getSensorFusionStatus(&sensorStatus, i); // Extract the individual sensor data for this sensor
myGNSS.getSensorFusionStatus(&sensorStatus, i); // Extract the individual sensor data for this sensor
Serial.print(i); Serial.print(F(" ")); // Print the sensor number
@@ -26,8 +26,8 @@
#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;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -37,20 +37,20 @@ void setup()
Wire.begin();
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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);
}
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
myGNSS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
if (myGPS.getEsfInfo()){
if (myGNSS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.packetUBXESFSTATUS->data.fusionMode);
Serial.println(myGNSS.packetUBXESFSTATUS->data.fusionMode);
if (myGPS.packetUBXESFSTATUS->data.fusionMode == 1){
if (myGNSS.packetUBXESFSTATUS->data.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
@@ -63,20 +63,20 @@ void setup()
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
if (myGNSS.getEsfAlignment()) // Poll new ESF ALG data
{
Serial.print(F("Status: "));
Serial.print(myGPS.packetUBXESFALG->data.flags.bits.status);
Serial.print(myGNSS.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(myGNSS.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(myGNSS.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(myGNSS.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);
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.tiltAlgError);
Serial.print(myGNSS.packetUBXESFALG->data.error.bits.yawAlgError);
Serial.println(myGNSS.packetUBXESFALG->data.error.bits.angleError);
}
delay(250);
@@ -29,8 +29,8 @@
#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;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
void setup()
{
@@ -40,55 +40,55 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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.)"));
}
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
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 (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
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"));
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
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 (myGPS.getHNRAtt(125) == true) // Request HNR Att data using a 125ms timeout
if (myGNSS.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(myGNSS.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(myGNSS.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
Serial.println(myGNSS.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
if (myGNSS.getHNRDyn(125) == true) // Request HNR Dyn data using a 125ms timeout
{
Serial.print(F("xAccel: "));
Serial.print(myGPS.packetUBXHNRINS->data.xAccel);
Serial.print(myGNSS.packetUBXHNRINS->data.xAccel);
Serial.print(F(" yAccel: "));
Serial.print(myGPS.packetUBXHNRINS->data.yAccel);
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
Serial.print(F(" zAccel: "));
Serial.println(myGPS.packetUBXHNRINS->data.zAccel);
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
}
if (myGPS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
if (myGNSS.getHNRPVT(125) == true) // Request HNR PVT data using a 125ms timeout
{
Serial.print(F("ns: "));
Serial.print(myGPS.packetUBXHNRPVT->data.nano);
Serial.print(myGNSS.packetUBXHNRPVT->data.nano);
Serial.print(F(" Lat: "));
Serial.print(myGPS.packetUBXHNRPVT->data.lat);
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
Serial.print(F(" Lon: "));
Serial.println(myGPS.packetUBXHNRPVT->data.lon);
Serial.println(myGNSS.packetUBXHNRPVT->data.lon);
}
}
@@ -28,8 +28,8 @@
#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;
#include <SparkFun_u-blox_GNSS_Arduino_Library.h> //http://librarymanager/All#SparkFun_u-blox_GNSS
SFE_UBLOX_GNSS myGNSS;
boolean usingAutoHNRAtt = false;
boolean usingAutoHNRDyn = false;
@@ -43,65 +43,65 @@ void setup()
Wire.begin();
//myGPS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
//myGNSS.enableDebugging(); // Uncomment this line to enable debug messages on Serial
if (myGPS.begin() == false) //Connect to the u-blox module using Wire port
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.)"));
}
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
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 (myGPS.setHNRNavigationRate(10) == true) //Set the High Navigation Rate to 10Hz
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 = myGPS.setAutoHNRATT(true); //Attempt to enable auto HNR attitude messages
usingAutoHNRAtt = myGNSS.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
usingAutoHNRDyn = myGNSS.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
usingAutoHNRPVT = myGNSS.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
if (usingAutoHNRAtt && (myGNSS.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(myGNSS.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(myGNSS.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
Serial.println(myGNSS.getHNRheading(), 2); // Use the helper function to get the heading in degrees
myGNSS.flushHNRATT(); // Mark data as stale
}
if (usingAutoHNRDyn && (myGPS.getHNRDyn() == true)) // If setAutoHNRDyn was successful and new data is available
if (usingAutoHNRDyn && (myGNSS.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(myGNSS.packetUBXHNRINS->data.xAccel);
Serial.print(F(" yAccel: "));
Serial.print(myGPS.packetUBXHNRINS->data.yAccel);
Serial.print(myGNSS.packetUBXHNRINS->data.yAccel);
Serial.print(F(" zAccel: "));
Serial.println(myGPS.packetUBXHNRINS->data.zAccel);
myGPS.flushHNRINS(); // Mark data as stale
Serial.println(myGNSS.packetUBXHNRINS->data.zAccel);
myGNSS.flushHNRINS(); // Mark data as stale
}
if (usingAutoHNRPVT && (myGPS.getHNRPVT() == true)) // If setAutoHNRPVT was successful and new data is available
if (usingAutoHNRPVT && (myGNSS.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(myGNSS.packetUBXHNRPVT->data.nano);
Serial.print(F(" Lat: "));
Serial.print(myGPS.packetUBXHNRPVT->data.lat);
Serial.print(myGNSS.packetUBXHNRPVT->data.lat);
Serial.print(F(" Lon: "));
Serial.println(myGPS.packetUBXHNRPVT->data.lon);
myGPS.flushHNRPVT(); // Mark data as stale
Serial.println(myGNSS.packetUBXHNRPVT->data.lon);
myGNSS.flushHNRPVT(); // Mark data as stale
}
}