1414 SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
1515 Open the serial monitor at 115200 baud to see the output
1616
17- After calibrating the module and securing it to your vehicle such that it's
18- stable within 2 degrees, and the board is oriented correctly with regards to
19- the vehicle's frame, you can now read the vehicle's "attitude". The attitude
20- includes the vehicle's heading, pitch, and roll. You can also check the
21- accuracy of those readings.
22-
17+ getEsfAlignment (UBX-ESF-ALG) reports the status and alignment angles of the IMU within the vehicle.
18+ These define the rotation of the IMU frame within the vehicle (installation frame) - not the heading
19+ of the vehicle itself. The vehicle attitude solution is reported separately by getNAVATT (UBX-NAV-ATT).
2320*/
2421
2522#include < Wire.h> // Needed for I2C to GNSS
@@ -44,6 +41,8 @@ void setup()
4441
4542 myGNSS.setI2COutput (COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
4643
44+ myGNSS.setESFAutoAlignment (true ); // Enable Automatic IMU-mount Alignment
45+
4746 if (myGNSS.getEsfInfo ()){
4847
4948 Serial.print (F (" Fusion Mode: " ));
@@ -64,19 +63,31 @@ void loop()
6463 // ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
6564 if (myGNSS.getEsfAlignment ()) // Poll new ESF ALG data
6665 {
67- Serial.print (F (" Status: " ));
68- Serial.print (myGNSS.packetUBXESFALG ->data .flags .bits .status );
66+ Serial.print (F (" IMU-Mount Alignment: On/Off: " ));
67+ Serial.print (myGNSS.packetUBXESFALG ->data .flags .bits .autoMntAlgOn );
68+ Serial.print (F (" Status: " ));
69+ Serial.print (myGNSS.packetUBXESFALG ->data .flags .bits .status );
6970 Serial.print (F (" Roll: " ));
7071 Serial.print (myGNSS.getESFroll (), 2 ); // Use the helper function to get the roll in degrees
7172 Serial.print (F (" Pitch: " ));
7273 Serial.print (myGNSS.getESFpitch (), 2 ); // Use the helper function to get the pitch in degrees
73- Serial.print (F (" Heading : " ));
74+ Serial.print (F (" Yaw : " ));
7475 Serial.print (myGNSS.getESFyaw (), 2 ); // Use the helper function to get the yaw in degrees
7576 Serial.print (F (" Errors: " ));
7677 Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .tiltAlgError );
7778 Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .yawAlgError );
7879 Serial.println (myGNSS.packetUBXESFALG ->data .error .bits .angleError );
7980 }
8081
82+ if (myGNSS.getNAVATT ()) // Poll new NAV ATT data
83+ {
84+ Serial.print (F (" Vehicle Attitude: Roll: " ));
85+ Serial.print (myGNSS.getATTroll (), 2 ); // Use the helper function to get the roll in degrees
86+ Serial.print (F (" Pitch: " ));
87+ Serial.print (myGNSS.getATTpitch (), 2 ); // Use the helper function to get the pitch in degrees
88+ Serial.print (F (" Heading: " ));
89+ Serial.println (myGNSS.getATTheading (), 2 ); // Use the helper function to get the heading in degrees
90+ }
91+
8192 delay (250 );
8293}
0 commit comments