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

Commit 29449fc

Browse files
committed
Removes array from raw data, updates example 1
1 parent a8fc05f commit 29449fc

File tree

3 files changed

+35
-24
lines changed

3 files changed

+35
-24
lines changed

examples/Dead Reckoning/Example1_calibrateSensor/Example1_getIMU.ino renamed to examples/Dead Reckoning/Example1_calibrateSensor/Example1_calibrateSensor.ino

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,25 @@
99
1010
Feel like supporting open source hardware?
1111
Buy a board from SparkFun!
12-
NEO-M8U: https://www.sparkfun.com/products/15136
13-
ZED-F9R: https://www.sparkfun.com/products/15136
12+
NEO-M8U: https://www.sparkfun.com/products/16329
13+
ZED-F9R: https://www.sparkfun.com/products/16344
1414
1515
Hardware Connections:
16-
Plug a Qwiic cable into the GPS and a BlackBoard
16+
Plug a Qwiic cable into the GPS and a Redboard Qwiic
1717
If you don't have a platform with a Qwiic connection use the SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
1818
Open the serial monitor at 115200 baud to see the output
19+
20+
To take advantage of the internal IMU of either the Dead Reckoning GPS
21+
boards (ZED-F9R, NEO-M8U), you must first calibrate them. This includes securing the GPS module
22+
to your vehicle so that it is stable within 2 degrees and that the frame of
23+
reference of the board is consistent with the picture outlined in the
24+
Receiver-Description-Prot-Spec Datasheet under Automotive/Untethered Dead
25+
Reckoning. You may also check either the ZED-F9R or NEO-M8U Hookup Guide for
26+
more information. After the board is secure, you'll need to put the module
27+
through certain conditions for proper calibration: acceleration, turning,
28+
stopping, all under a clear sky 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.
1931
*/
2032

2133
#include <Wire.h> //Needed for I2C to GPS
@@ -42,7 +54,12 @@ void setup()
4254

4355
void loop()
4456
{
45-
if (myGPS.getEsfInfo())
46-
Serial.println(myGPS.imuMeas.fusionMode);
4757

58+
if (myGPS.getEsfInfo()){
59+
Serial.println(myGPS.imuMeas.fusionMode);
60+
if (myGPS.imuMeas.fusionMode) == 1
61+
Serial.println("Sensor is calibrated!");
62+
}
4863

64+
delay(250)
65+
}

src/SparkFun_Ublox_Arduino_Library.cpp

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2731,7 +2731,7 @@ boolean SFE_UBLOX_GPS::getEsfInfo(uint16_t maxWait)
27312731
}
27322732

27332733
//
2734-
boolean SFE_UBLOX_GPS::getEsfMeas(uint16_t maxWait)
2734+
boolean SFE_UBLOX_GPS::getEsfIns(uint16_t maxWait)
27352735
{
27362736
packetCfg.cls = UBX_CLASS_ESF;
27372737
packetCfg.id = UBX_ESF_INS;
@@ -2760,8 +2760,6 @@ boolean SFE_UBLOX_GPS::getEsfMeas(uint16_t maxWait)
27602760
imuMeas.xAccel = extractLong(24); // m/s
27612761
imuMeas.yAccel = extractLong(28); // m/s
27622762
imuMeas.zAccel = extractLong(32); // m/s
2763-
2764-
return(true);
27652763
}
27662764

27672765
//
@@ -2786,10 +2784,12 @@ boolean SFE_UBLOX_GPS::getEsfDataInfo(uint16_t maxWait)
27862784
uint8_t tagValid = (flags && 0x04) >> 3;
27872785
uint8_t numMeas = (flags && 0x1000) >> 15;
27882786

2787+
if (numMeas > DEF_NUM_SENS)
2788+
numMeas = DEF_NUM_SENS;
2789+
27892790
uint8_t byteOffset = 4;
2790-
uint8_t numSens = extractByte(15);
27912791

2792-
for(uint8_t i=0; i<numSens; i++){
2792+
for(uint8_t i=0; i<numMeas; i++){
27932793

27942794
uint32_t bitField = extractLong(4 + byteOffset * i);
27952795
imuMeas.dataType[i] = (bitField && 0xFF000000) >> 23;
@@ -2815,17 +2815,11 @@ boolean SFE_UBLOX_GPS::getEsfRawDataInfo(uint16_t maxWait)
28152815

28162816
checkUblox();
28172817

2818-
uint8_t byteOffset = 8;
2819-
uint8_t numSens = extractByte(15);
2820-
2821-
for(uint8_t i=0; i<numSens; i++){
2818+
uint32_t bitField = extractLong(4);
2819+
imuMeas.rawDataType = (bitField && 0xFF000000) >> 23;
2820+
imuMeas.rawData = (bitField && 0xFFFFFF);
2821+
imuMeas.rawTStamp = extractLong(8);
28222822

2823-
uint32_t bitField = extractLong(4 + byteOffset * i);
2824-
imuMeas.rawDataType[i] = (bitField && 0xFF000000) >> 23;
2825-
imuMeas.rawData[i] = (bitField && 0xFFFFFF);
2826-
imuMeas.rawTStamp[i] = extractLong(8 + byteOffset * i);
2827-
2828-
}
28292823
}
28302824

28312825
sfe_ublox_status_e SFE_UBLOX_GPS::getSensState(uint8_t sensor, uint16_t maxWait)

src/SparkFun_Ublox_Arduino_Library.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ class SFE_UBLOX_GPS
591591
boolean setDynamicModel(dynModel newDynamicModel = DYN_MODEL_PORTABLE, uint16_t maxWait = 1100);
592592

593593
boolean getEsfInfo(uint16_t maxWait = 1100);
594-
boolean getEsfMeas(uint16_t maxWait = 1100);
594+
boolean getEsfIns(uint16_t maxWait = 1100);
595595
boolean getEsfDataInfo(uint16_t maxWait = 1100);
596596
boolean getEsfRawDataInfo(uint16_t maxWait = 1100);
597597
sfe_ublox_status_e getSensState(uint8_t sensor, uint16_t maxWait = 1100);
@@ -691,9 +691,9 @@ class SFE_UBLOX_GPS
691691
int32_t zAccel;
692692

693693
// The array size is based on testing directly on M8U and F9R
694-
uint32_t rawData[DEF_NUM_SENS];
695-
uint32_t rawDataType[DEF_NUM_SENS];
696-
uint32_t rawTStamp[DEF_NUM_SENS];
694+
uint32_t rawData;
695+
uint32_t rawDataType;
696+
uint32_t rawTStamp;
697697

698698
uint32_t data[DEF_NUM_SENS];
699699
uint32_t dataType[DEF_NUM_SENS];

0 commit comments

Comments
 (0)