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

Commit dc28c12

Browse files
authored
Merge pull request #96 from sparkfun/dead_reckoning
Dead reckoning Pull request
2 parents 3f5422d + 685b093 commit dc28c12

File tree

8 files changed

+610
-0
lines changed

8 files changed

+610
-0
lines changed

Diff for: .gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ $RECYCLE.BIN/
4848
Network Trash Folder
4949
Temporary Items
5050
.apdisk
51+
52+
# VIM backup files
53+
*~
54+
[._]*.un~
55+
*.swp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
To take advantage of the internal IMU of either the Dead Reckoning GPS
20+
boards (ZED-F9R, NEO-M8U), you must first calibrate it. This includes securing the GPS module
21+
to your vehicle so that it is stable within 2 degrees and that the frame of
22+
reference of the board is consistent with the picture outlined in the
23+
Receiver-Description-Prot-Spec Datasheet under Automotive/Untethered Dead
24+
Reckoning. You may also check either the ZED-F9R or NEO-M8U Hookup Guide for
25+
more information. After the board is secure, you'll need to put the module
26+
through certain conditions for proper calibration: acceleration, turning,
27+
stopping for a few minutes, getting to a speed over 30km/h all under a clear sky
28+
with good GNSS signal. This example simply looks at the
29+
"fusionMode" status which indicates whether the SparkFun Dead Reckoning is
30+
not-calibrated - 0, or calibrated - 1.
31+
*/
32+
33+
#include <Wire.h> //Needed for I2C to GPS
34+
35+
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
36+
SFE_UBLOX_GPS myGPS;
37+
38+
void setup()
39+
{
40+
Serial.begin(115200);
41+
while (!Serial); //Wait for user to open terminal
42+
Serial.println(F("SparkFun Ublox Example"));
43+
44+
Wire.begin();
45+
46+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
47+
{
48+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
49+
while (1);
50+
}
51+
52+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
53+
}
54+
55+
void loop()
56+
{
57+
58+
if (myGPS.getEsfInfo()){
59+
Serial.print(F("Fusion Mode: "));
60+
Serial.println(myGPS.imuMeas.fusionMode);
61+
if (myGPS.imuMeas.fusionMode == 1)
62+
Serial.println(F("Sensor is calibrated!"));
63+
}
64+
65+
delay(250);
66+
}
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(F("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(F("Fusion Mode: "));
49+
Serial.println(myGPS.imuMeas.fusionMode);
50+
51+
if (myGPS.imuMeas.fusionMode == 1){
52+
Serial.println(F("Fusion Mode is Initialized!"));
53+
}
54+
else {
55+
Serial.println(F("Fusion Mode is either disabled or not initialized - Freezing!"));
56+
Serial.println(F("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(F("X: "));
67+
Serial.println(myGPS.imuMeas.xAngRate);
68+
Serial.print(F("Y: "));
69+
Serial.println(myGPS.imuMeas.yAngRate);
70+
Serial.print(F("Z: "));
71+
Serial.println(myGPS.imuMeas.zAngRate);
72+
Serial.print(F("X Acceleration: "));
73+
Serial.println(myGPS.imuMeas.xAccel);
74+
Serial.print(F("Y Acceleration: "));
75+
Serial.println(myGPS.imuMeas.yAccel);
76+
Serial.print(F("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+
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(F("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(F("Fusion Mode: "));
56+
Serial.println(myGPS.imuMeas.fusionMode);
57+
58+
if (myGPS.imuMeas.fusionMode == 1){
59+
Serial.println(F("Fusion Mode is Initialized!"));
60+
}
61+
else {
62+
Serial.println(F("Fusion Mode is either disabled or not initialized - Freezing!"));
63+
Serial.println(F("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(F("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(F("Being Used: "));
78+
Serial.println(myGPS.ubloxSen.isUsed);
79+
Serial.print(F("Is Ready: "));
80+
Serial.println(myGPS.ubloxSen.isReady);
81+
Serial.print(F("Calibration Status: "));
82+
Serial.println(myGPS.ubloxSen.calibStatus);
83+
Serial.print(F("Time Status: "));
84+
Serial.println(myGPS.ubloxSen.timeStatus);
85+
Serial.print(F("Bad Measure: "));
86+
Serial.println(myGPS.ubloxSen.timeStatus);
87+
Serial.print(F("Bad Time Tag: "));
88+
Serial.println(myGPS.ubloxSen.badTag);
89+
Serial.print(F("Missed Measure : "));
90+
Serial.println(myGPS.ubloxSen.missMeas);
91+
Serial.print(F("Noisy Measure: "));
92+
Serial.println(myGPS.ubloxSen.noisyMeas);
93+
}
94+
95+
}
96+
97+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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 and securing it to your vehicle such that it's
20+
stable within 2 degrees, and the board is oriented correctly with regards to
21+
the vehicle's frame, you can now read the vehicle's "attitude". The attitude
22+
includes the vehicle's heading, pitch, and roll. You can also check the
23+
accuracy of those readings.
24+
25+
*/
26+
27+
#include <Wire.h> //Needed for I2C to GPS
28+
29+
#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
30+
SFE_UBLOX_GPS myGPS;
31+
32+
void setup()
33+
{
34+
Serial.begin(115200);
35+
while (!Serial); //Wait for user to open terminal
36+
Serial.println(F("SparkFun Ublox Example"));
37+
38+
Wire.begin();
39+
40+
if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
41+
{
42+
Serial.println(F("Ublox GPS not detected at default I2C address. Please check wiring. Freezing."));
43+
while (1);
44+
}
45+
46+
myGPS.setI2COutput(COM_TYPE_UBX); //Set the I2C port to output UBX only (turn off NMEA noise)
47+
48+
if (myGPS.getEsfInfo()){
49+
50+
Serial.print(F("Fusion Mode: "));
51+
Serial.println(myGPS.imuMeas.fusionMode);
52+
53+
if (myGPS.imuMeas.fusionMode == 1){
54+
Serial.println(F("Fusion Mode is Initialized!"));
55+
}
56+
else {
57+
Serial.println(F("Fusion Mode is either disabled or not initialized - Freezing!"));
58+
Serial.println(F("Please see Example 1 description at top for more information."));
59+
}
60+
}
61+
}
62+
63+
void loop()
64+
{
65+
myGPS.getVehAtt(); // Give the sensor you want to check on.
66+
Serial.print(F("Roll: "));
67+
Serial.println(myGPS.vehAtt.roll);
68+
Serial.print(F("Pitch: "));
69+
Serial.println(myGPS.vehAtt.pitch);
70+
Serial.print(F("Heading: "));
71+
Serial.println(myGPS.vehAtt.heading);
72+
Serial.print(F("Roll Accuracy: "));
73+
Serial.println(myGPS.vehAtt.accRoll);
74+
Serial.print(F("Pitch Accuracy: "));
75+
Serial.println(myGPS.vehAtt.accPitch);
76+
Serial.print(F("Heading Accuracy: "));
77+
Serial.println(myGPS.vehAtt.accHeading);
78+
79+
delay(250);
80+
}
81+
82+

Diff for: keywords.txt

+12
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@ disableMessage KEYWORD2
144144
enableNMEAMessage KEYWORD2
145145
disableNMEAMessage KEYWORD2
146146

147+
getEsfInfo KEYWORD2
148+
getEsfIns KEYWORD2
149+
getEsfDataInfo KEYWORD2
150+
getEsfRawDataInfo KEYWORD2
151+
152+
getSensState KEYWORD2
153+
getVehAtt KEYWORD2
147154
#######################################
148155
# Constants (LITERAL1)
149156
#######################################
@@ -211,3 +218,8 @@ DYN_MODEL_AIRBORNE2g LITERAL1
211218
DYN_MODEL_AIRBORNE4g LITERAL1
212219
DYN_MODEL_WRIST LITERAL1
213220
DYN_MODEL_BIKE LITERAL1
221+
222+
UBX_ESF_STATUS LITERAL1
223+
UBX_ESF_RAW LITERAL1
224+
UBX_ESF_MEAS LITERAL1
225+
UBX_ESF_INS LITERAL1

0 commit comments

Comments
 (0)