14
14
SparkFun Qwiic Breadboard Jumper (https://www.sparkfun.com/products/14425)
15
15
Open the serial monitor at 115200 baud to see the output
16
16
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).
23
20
*/
24
21
25
22
#include < Wire.h> // Needed for I2C to GNSS
@@ -44,6 +41,8 @@ void setup()
44
41
45
42
myGNSS.setI2COutput (COM_TYPE_UBX); // Set the I2C port to output UBX only (turn off NMEA noise)
46
43
44
+ myGNSS.setESFAutoAlignment (true ); // Enable Automatic IMU-mount Alignment
45
+
47
46
if (myGNSS.getEsfInfo ()){
48
47
49
48
Serial.print (F (" Fusion Mode: " ));
@@ -64,19 +63,31 @@ void loop()
64
63
// ESF data is produced at the navigation rate, so by default we'll get fresh data once per second
65
64
if (myGNSS.getEsfAlignment ()) // Poll new ESF ALG data
66
65
{
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 );
69
70
Serial.print (F (" Roll: " ));
70
71
Serial.print (myGNSS.getESFroll (), 2 ); // Use the helper function to get the roll in degrees
71
72
Serial.print (F (" Pitch: " ));
72
73
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 : " ));
74
75
Serial.print (myGNSS.getESFyaw (), 2 ); // Use the helper function to get the yaw in degrees
75
76
Serial.print (F (" Errors: " ));
76
77
Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .tiltAlgError );
77
78
Serial.print (myGNSS.packetUBXESFALG ->data .error .bits .yawAlgError );
78
79
Serial.println (myGNSS.packetUBXESFALG ->data .error .bits .angleError );
79
80
}
80
81
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
+
81
92
delay (250 );
82
93
}
0 commit comments