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

Dead reckoning Pull request #96

Merged
merged 14 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ $RECYCLE.BIN/
Network Trash Folder
Temporary Items
.apdisk

# VIM backup files
*~
[._]*.un~
*.swp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
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 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

To take advantage of the internal IMU of either the Dead Reckoning GPS
boards (ZED-F9R, NEO-M8U), you must first calibrate it. This includes securing the GPS 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
not-calibrated - 0, or calibrated - 1.
*/

#include <Wire.h> //Needed for I2C to GPS

#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
SFE_UBLOX_GPS myGPS;

void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun Ublox Example"));

Wire.begin();

if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Ublox GPS 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)
}

void loop()
{

if (myGPS.getEsfInfo()){
Serial.print(F("Fusion Mode: "));
Serial.println(myGPS.imuMeas.fusionMode);
if (myGPS.imuMeas.fusionMode == 1)
Serial.println(F("Sensor is calibrated!"));
}

delay(250);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
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 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

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 GPS

#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
SFE_UBLOX_GPS myGPS;

void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun Ublox Example"));

Wire.begin();

if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Ublox GPS 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.imuMeas.fusionMode);

if (myGPS.imuMeas.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
Serial.println(F("Fusion Mode is either disabled or not initialized - Freezing!"));
Serial.println(F("Please see Example 1 description at top for more information."));
}
}
}

void loop()
{

if (myGPS.getEsfIns())
{
Serial.print(F("X: "));
Serial.println(myGPS.imuMeas.xAngRate);
Serial.print(F("Y: "));
Serial.println(myGPS.imuMeas.yAngRate);
Serial.print(F("Z: "));
Serial.println(myGPS.imuMeas.zAngRate);
Serial.print(F("X Acceleration: "));
Serial.println(myGPS.imuMeas.xAccel);
Serial.print(F("Y Acceleration: "));
Serial.println(myGPS.imuMeas.yAccel);
Serial.print(F("Z Acceleration: "));
Serial.println(myGPS.imuMeas.zAccel);
// These values also have "validity checks" that can be provided by the
// ublox library, add "Vald" to values: e.g. xAngRateVald or xAccelVald.
}

delay(250);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
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 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

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 GPS

#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
SFE_UBLOX_GPS myGPS;

void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun Ublox Example"));

Wire.begin();

if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Ublox GPS 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.imuMeas.fusionMode);

if (myGPS.imuMeas.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
Serial.println(F("Fusion Mode is either disabled or not initialized - Freezing!"));
Serial.println(F("Please see Example 1 description at top for more information."));
}
}
}

void loop()
{

for(int i=1; i<=myGPS.ubloxSen.numSens; i++){
myGPS.getSensState(i); // Give the sensor you want to check on.
Serial.print(F("Sensor Data Type: ")); //See ublox receiver description
//or our hookup guide for information on the
//return value.
Serial.println(myGPS.ubloxSen.senType);
Serial.print(F("Being Used: "));
Serial.println(myGPS.ubloxSen.isUsed);
Serial.print(F("Is Ready: "));
Serial.println(myGPS.ubloxSen.isReady);
Serial.print(F("Calibration Status: "));
Serial.println(myGPS.ubloxSen.calibStatus);
Serial.print(F("Time Status: "));
Serial.println(myGPS.ubloxSen.timeStatus);
Serial.print(F("Bad Measure: "));
Serial.println(myGPS.ubloxSen.timeStatus);
Serial.print(F("Bad Time Tag: "));
Serial.println(myGPS.ubloxSen.badTag);
Serial.print(F("Missed Measure : "));
Serial.println(myGPS.ubloxSen.missMeas);
Serial.print(F("Noisy Measure: "));
Serial.println(myGPS.ubloxSen.noisyMeas);
}

}


Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
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 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

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 GPS

#include <SparkFun_Ublox_Arduino_Library.h> //http://librarymanager/All#SparkFun_Ublox_GPS
SFE_UBLOX_GPS myGPS;

void setup()
{
Serial.begin(115200);
while (!Serial); //Wait for user to open terminal
Serial.println(F("SparkFun Ublox Example"));

Wire.begin();

if (myGPS.begin() == false) //Connect to the Ublox module using Wire port
{
Serial.println(F("Ublox GPS 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.imuMeas.fusionMode);

if (myGPS.imuMeas.fusionMode == 1){
Serial.println(F("Fusion Mode is Initialized!"));
}
else {
Serial.println(F("Fusion Mode is either disabled or not initialized - Freezing!"));
Serial.println(F("Please see Example 1 description at top for more information."));
}
}
}

void loop()
{
myGPS.getVehAtt(); // Give the sensor you want to check on.
Serial.print(F("Roll: "));
Serial.println(myGPS.vehAtt.roll);
Serial.print(F("Pitch: "));
Serial.println(myGPS.vehAtt.pitch);
Serial.print(F("Heading: "));
Serial.println(myGPS.vehAtt.heading);
Serial.print(F("Roll Accuracy: "));
Serial.println(myGPS.vehAtt.accRoll);
Serial.print(F("Pitch Accuracy: "));
Serial.println(myGPS.vehAtt.accPitch);
Serial.print(F("Heading Accuracy: "));
Serial.println(myGPS.vehAtt.accHeading);

delay(250);
}


12 changes: 12 additions & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ disableMessage KEYWORD2
enableNMEAMessage KEYWORD2
disableNMEAMessage KEYWORD2

getEsfInfo KEYWORD2
getEsfIns KEYWORD2
getEsfDataInfo KEYWORD2
getEsfRawDataInfo KEYWORD2

getSensState KEYWORD2
getVehAtt KEYWORD2
#######################################
# Constants (LITERAL1)
#######################################
Expand Down Expand Up @@ -211,3 +218,8 @@ DYN_MODEL_AIRBORNE2g LITERAL1
DYN_MODEL_AIRBORNE4g LITERAL1
DYN_MODEL_WRIST LITERAL1
DYN_MODEL_BIKE LITERAL1

UBX_ESF_STATUS LITERAL1
UBX_ESF_RAW LITERAL1
UBX_ESF_MEAS LITERAL1
UBX_ESF_INS LITERAL1
Loading