SparkFun GPS Dead Reckoning NEO-M8U Hookup Guide

Pages
Contributors: bboyho, Elias The Sparkiest
Favorited Favorite 3

Example 4 - Vehicle Dynamics

What happened to Example 3? It's been skipped over because its used primarily as a diagnostic sketch. What sensors are currently being used, are they functioning correctly, are the measurements being listed as bad or non-existent? Example 3 helps diagnose these various issues. Lets move ahead to the fourth example in the library (located in File Examples > SparkFun u-blox GNSS Arduino Library > Dead Reckoning > Example4_vehicleDynamics)

The vehicle attitude is a termed coined by u-blox that encompasses three measurements: vehicle pitch, vehicle roll, and vehicle heading. Much like the other example sketches, this one checks to make sure that the SparkFun Dead Reckoning NEO-M8U has been calibrated before pulling data.

language:c
if (myGNSS.getEsfInfo()){

    Serial.print("Fusion Mode: ");  
    Serial.println(myGNSS.imuMeas.fusionMode);  

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

If the SparkFun Dead Reckoning NEO-M8U has indeed been calibrated, then it gets the relevant information by calling myGNSS.getVehAtt(). As in Example 2, the data is stored within a struct called vehAtt.

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

        delay(250);
}

If you have not already, select your Board (in this case the Arduino Uno), and associated COM port. Upload the code to the board and set the serial monitor to 115200 baud. This may be a good time to bring a friend along to drive if you decide to actively monitor the output. Otherwise, check out the data after taking the board for a stroll. Try driving around as the board senses the car's movement. Then park in a safe location with the engine turned off before inspecting the data.