1616 SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
1717 Open the serial monitor at 115200 baud to see the output
1818
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.
19+ getEsfAlignment (UBX-ESF-ALG) reports the status and alignment angles of the IMU within the vehicle.
20+ These define the rotation of the IMU frame within the vehicle (installation frame) - not the heading
21+ of the vehicle itself. The vehicle attitude solution is reported separately by getNAVATT (UBX-NAV-ATT).
2422
2523*/
2624
@@ -45,6 +43,8 @@ void setup()
4543
4644 myGNSS.setI2COutput (COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
4745
46+ myGNSS.setESFAutoAlignment (true ); // Enable Automatic IMU-mount Alignment
47+
4848 if (myGNSS.getEsfInfo ()){
4949
5050 Serial.print (F (" Fusion Mode: " ));
@@ -63,20 +63,32 @@ void setup()
6363void loop ()
6464{
6565 // ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
66- if (myGNSS.getEsfAlignment ()) // Poll new ESF ALG data
66+ if (myGNSS.getEsfAlignment ()) // Poll new ESF ALG data
6767 {
68- Serial.print (F (" Status: " ));
69- Serial.print (myGNSS.packetUBXESFALG ->data .flags .bits .status );
68+ Serial.print (F (" IMU-Mount Alignment: On/Off: " ));
69+ Serial.print (myGNSS.packetUBXESFALG ->data .flags .bits .autoMntAlgOn );
70+ Serial.print (F (" Status: " ));
71+ Serial.print (myGNSS.packetUBXESFALG ->data .flags .bits .status );
7072 Serial.print (F (" Roll: " ));
7173 Serial.print (myGNSS.getESFroll (), 2 ); // Use the helper function to get the roll in degrees
72- Serial.print (F (" Pitch: " ));
73- Serial.print (myGNSS.getESFpitch (), 2 ); // Use the helper function to get the pitch in degrees
74- Serial.print (F (" Heading: " ));
75- Serial.print (myGNSS.getESFyaw (), 2 ); // Use the helper function to get the yaw in degrees
76- Serial.print (F (" Errors: " ));
77- Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .tiltAlgError );
78- Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .yawAlgError );
79- Serial.println (myGNSS.packetUBXESFALG ->data .error .bits .angleError );
74+ Serial.print (F (" Pitch: " ));
75+ Serial.print (myGNSS.getESFpitch (), 2 ); // Use the helper function to get the pitch in degrees
76+ Serial.print (F (" Yaw: " ));
77+ Serial.print (myGNSS.getESFyaw (), 2 ); // Use the helper function to get the yaw in degrees
78+ Serial.print (F (" Errors: " ));
79+ Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .tiltAlgError );
80+ Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .yawAlgError );
81+ Serial.println (myGNSS.packetUBXESFALG ->data .error .bits .angleError );
82+ }
83+
84+ if (myGNSS.getNAVATT ()) // Poll new NAV ATT data
85+ {
86+ Serial.print (F (" Vehicle Attitude: Roll: " ));
87+ Serial.print (myGNSS.getATTroll (), 2 ); // Use the helper function to get the roll in degrees
88+ Serial.print (F (" Pitch: " ));
89+ Serial.print (myGNSS.getATTpitch (), 2 ); // Use the helper function to get the pitch in degrees
90+ Serial.print (F (" Heading: " ));
91+ Serial.println (myGNSS.getATTheading (), 2 ); // Use the helper function to get the heading in degrees
8092 }
8193
8294 delay (250 );
0 commit comments