Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 156233d

Browse files
committed
Fixes naming of example code, fleashes out example 2-3
1 parent 33e8fe2 commit 156233d

File tree

6 files changed

+189
-135
lines changed

6 files changed

+189
-135
lines changed

examples/Dead Reckoning/Example1_calibrateSensor/Example1_calibrateSensor.ino

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
/*
2-
Some Description
32
By: Elias Santistevan
43
SparkFun Electronics
5-
Date: February
4+
Date: May, 2020
65
License: MIT. See license file for more information but you can
76
basically do whatever you want with this code.
87
9-
108
Feel like supporting open source hardware?
119
Buy a board from SparkFun!
1210
NEO-M8U: https://www.sparkfun.com/products/16329
1311
ZED-F9R: https://www.sparkfun.com/products/16344
1412
1513
Hardware Connections:
1614
Plug a Qwiic cable into the GPS and a Redboard Qwiic
17-
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
15+
If you don't have a platform with a Qwiic connection use the
16+
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
1817
Open the serial monitor at 115200 baud to see the output
1918
2019
To take advantage of the internal IMU of either the Dead Reckoning GPS
@@ -56,6 +55,7 @@ void loop()
5655
{
5756

5857
if (myGPS.getEsfInfo()){
58+
Serial.print("Fusion Mode: ");
5959
Serial.println(myGPS.imuMeas.fusionMode);
6060
if (myGPS.imuMeas.fusionMode == 1)
6161
Serial.println("Sensor is calibrated!");
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
By: Elias Santistevan
3+
SparkFun Electronics
4+
Date: May, 2020
5+
License: MIT. See license file for more information but you can
6+
basically do whatever you want with this code.
7+
8+
Feel like supporting open source hardware?
9+
Buy a board from SparkFun!
10+
NEO-M8U: https://www.sparkfun.com/products/16329
11+
ZED-F9R: https://www.sparkfun.com/products/16344
12+
13+
Hardware Connections:
14+
Plug a Qwiic cable into the GPS and a Redboard Qwiic
15+
If you don't have a platform with a Qwiic connection use the
16+
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
17+
Open the serial monitor at 115200 baud to see the output
18+
19+
After calibrating the module, also known as "Fusion Mode", you can get
20+
data directly from the IMU. This data is integrated directly into the GNSS
21+
output, but is provided by the module as well.
22+
23+
*/
24+
25+
#include <Wire.h> //Needed for I2C to GPS
26+
27+
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
28+
SFE_UBLOX_GPS myGPS;
29+
30+
void setup()
31+
{
32+
Serial.begin(115200);
33+
while (!Serial); //Wait for user to open terminal
34+
Serial.println("SparkFun Ublox Example");
35+
36+
Wire.begin();
37+
38+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
39+
{
40+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
41+
while (1);
42+
}
43+
44+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
45+
46+
if (myGPS.getEsfInfo()){
47+
48+
Serial.print("Fusion Mode: ");
49+
Serial.println(myGPS.imuMeas.fusionMode);
50+
51+
if (myGPS.imuMeas.fusionMode == 1){
52+
Serial.println("Fusion Mode is Initialized!");
53+
}
54+
else {
55+
Serial.println("Fusion Mode is either disabled or not initialized - Freezing!");
56+
Serial.println("Please see Example 1 description at top for more information.");
57+
}
58+
}
59+
}
60+
61+
void loop()
62+
{
63+
64+
if (myGPS.getEsfIns())
65+
{
66+
Serial.print("X: ");
67+
Serial.println(myGPS.imuMeas.xAngRate);
68+
Serial.print("Y: ");
69+
Serial.println(myGPS.imuMeas.yAngRate);
70+
Serial.print("Z: ");
71+
Serial.println(myGPS.imuMeas.zAngRate);
72+
Serial.print("X Acceleration: ");
73+
Serial.println(myGPS.imuMeas.xAccel);
74+
Serial.print("Y Acceleration: ");
75+
Serial.println(myGPS.imuMeas.yAccel);
76+
Serial.print("Z Acceleration: ");
77+
Serial.println(myGPS.imuMeas.zAccel);
78+
// These values also have "validity checks" that can be provided by the
79+
// ublox library, add "Vald" to values: e.g. xAngRateVald or xAccelVald.
80+
}
81+
82+
delay(250);
83+
}
84+

examples/Dead Reckoning/Example2_getImuData/Example1_getIMUData.ino

Lines changed: 0 additions & 65 deletions
This file was deleted.

examples/Dead Reckoning/Example3_getSensorStatus/Example1_getSensorStatus.ino

Lines changed: 0 additions & 65 deletions
This file was deleted.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
By: Elias Santistevan
3+
SparkFun Electronics
4+
Date: May, 2020
5+
License: MIT. See license file for more information but you can
6+
basically do whatever you want with this code.
7+
8+
Feel like supporting open source hardware?
9+
Buy a board from SparkFun!
10+
NEO-M8U: https://www.sparkfun.com/products/16329
11+
ZED-F9R: https://www.sparkfun.com/products/16344
12+
13+
Hardware Connections:
14+
Plug a Qwiic cable into the GPS and a Redboard Qwiic
15+
If you don't have a platform with a Qwiic connection use the
16+
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
17+
Open the serial monitor at 115200 baud to see the output
18+
19+
After calibrating the module, also known as "Fusion Mode", you can get
20+
data directly from the IMU. This example code walks you through trouble
21+
shooting or identifying the different states of any individual
22+
"external" (which include internal) sensors you've hooked up (vehicle speed
23+
sensor) or the internal IMU used by the modules. You can see if the sensor is
24+
being used, if it's calibrated, ready, what data type it returns, the state
25+
of the measurement etc.
26+
27+
*/
28+
29+
#include <Wire.h> //Needed for I2C to GPS
30+
31+
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
32+
SFE_UBLOX_GPS myGPS;
33+
34+
void setup()
35+
{
36+
Serial.begin(115200);
37+
while (!Serial); //Wait for user to open terminal
38+
Serial.println("SparkFun Ublox Example");
39+
40+
Wire.begin();
41+
42+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
43+
{
44+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
45+
while (1);
46+
}
47+
48+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
49+
50+
// GetEsfInfo also gets the number of sensors used by the ublox module, this
51+
// includes (in the case of the ZED-F9R) wheel tick input from the vehicle
52+
// speed sensor attached to the module.
53+
if (myGPS.getEsfInfo()){
54+
55+
Serial.print("Fusion Mode: ");
56+
Serial.println(myGPS.imuMeas.fusionMode);
57+
58+
if (myGPS.imuMeas.fusionMode == 1){
59+
Serial.println("Fusion Mode is Initialized!");
60+
}
61+
else {
62+
Serial.println("Fusion Mode is either disabled or not initialized - Freezing!");
63+
Serial.println("Please see Example 1 description at top for more information.");
64+
}
65+
}
66+
}
67+
68+
void loop()
69+
{
70+
71+
for(int i=1; i<=myGPS.ubloxSen.numSens; i++){
72+
myGPS.getSensState(i); // Give the sensor you want to check on.
73+
Serial.print("Sensor Data Type: "); //See ublox receiver description
74+
//or our hookup guide for information on the
75+
//return value.
76+
Serial.println(myGPS.ubloxSen.senType);
77+
Serial.print("Being Used: ");
78+
Serial.println(myGPS.ubloxSen.isUsed);
79+
Serial.print("Is Ready: ");
80+
Serial.println(myGPS.ubloxSen.isReady);
81+
Serial.print("Calibration Status: ");
82+
Serial.println(myGPS.ubloxSen.calibStatus);
83+
Serial.print("Time Status: ");
84+
Serial.println(myGPS.ubloxSen.timeStatus);
85+
Serial.print("Bad Measure: ");
86+
Serial.println(myGPS.ubloxSen.timeStatus);
87+
Serial.print("Bad Time Tag: ");
88+
Serial.println(myGPS.ubloxSen.badTag);
89+
Serial.print("Missed Measure : ");
90+
Serial.println(myGPS.ubloxSen.missMeas);
91+
Serial.print("Noisy Measure: ");
92+
Serial.println(myGPS.ubloxSen.noisyMeas);
93+
}
94+
95+
}
96+
97+

src/SparkFun_Ublox_Arduino_Library.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,7 @@ boolean SFE_UBLOX_GPS::getEsfInfo(uint16_t maxWait)
27252725
// payload should be loaded.
27262726
imuMeas.version = extractByte(4);
27272727
imuMeas.fusionMode = extractByte(12);
2728+
ubloxSen.numSens = extractByte(15);
27282729

27292730
// Individual Status Sensor in different function
27302731
return(true);
@@ -2867,7 +2868,7 @@ sfe_ublox_status_e SFE_UBLOX_GPS::getSensState(uint8_t sensor, uint16_t maxWait)
28672868

28682869
}
28692870

2870-
bool SFE_UBLOX_GPS::getVehAtt(uint16_t maxWait){
2871+
boolean SFE_UBLOX_GPS::getVehAtt(uint16_t maxWait){
28712872

28722873
packetCfg.cls = UBX_CLASS_NAV;
28732874
packetCfg.id = UBX_NAV_ATT;
@@ -2883,5 +2884,7 @@ bool SFE_UBLOX_GPS::getVehAtt(uint16_t maxWait){
28832884
vehAtt.accRoll = extractLong(20);
28842885
vehAtt.accPitch = extractLong(24);
28852886
vehAtt.accHeading = extractLong(28);
2887+
2888+
return true;
28862889

28872890
}

0 commit comments

Comments
 (0)