HI, i am new to this forum. i have asked to get the HEADING ANGLE data from the zubax GNSS 2. My question is how i can get the HEADING ANGLE data from the module?.In nmea sentence, HCHDG is available which tells the heading. but it does not gives the correct values i think so. Is there any other way to get the heading data from the module. Also if i am correct, i need to calibrate the compass and how to do that?
(note: i now that i can able to get all data from u-center. but, i am using arduino for my project and whatever nmea data is been sent to arduino through serial communication, so i cannot able to use i-center for checking.)
The unit reports the raw magnetic field readings in three axes and also the heading computed from the raw readings. The latter is only valid if the preconditions are met as explained in the datasheet:
In your case, evidently they are not met, hence you can’t rely on the computed heading and instead you need to do it manually from the raw readings. This requires calibration. To calibrate, you rotate the unit around all three axes, fit the collected data into a sphere, and then compensate the center offset of the sphere to adjust the readings. There is much literature that explains this process.
yes i did the calibration part. basically i done compass calibration via QGroundcontrol by connecting the gnss2 module to autopilot (Compass · ham_px4userguide). In qgc, heading indicator works correctly as i rotated the gnss2 module. But directly from gnss2 module through HCHDG message still giving wrong angles, basically it gives 0 degree almost at east.
And then i moved to calculate the heading from Raw 3D magnetic field vector data from PZUBAX message from NMEA.
Below code that i used to calculate the headind from Raw 3D magnetic field vector data:
but again giving some values around 0-80 degrees(approx).
Please point out anything that i missing…
Thanks you in advance…
I don’t see where you are applying the calibration coefficients in your code. Direct computation from raw magnetic field strength readings is not going to yield good results as I explained earlier.