# Heading in GPS data

**URL:** <https://discuss.px4.io/t/heading-in-gps-data/45902>\
**Category:** PX4 Autopilot\
**Created:** [June 5, 2025, 5:19pm UTC](https://discuss.px4.io/t/heading-in-gps-data/45902 "2025-06-05T17:19:53Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![trace\_lussy](https://discuss.px4.io/user_avatar/discuss.px4.io/trace_lussy/32/19616_2.png) [@trace\_lussy](https://discuss.px4.io/u/trace_lussy)\
**Post date:** [June 5, 2025, 5:19pm UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/1 "2025-06-05T17:19:53Z")

</div>

I used a dual antenna gps module that is not in the px4 manual, which can directly provide an accurate navigation. The module leads out a data line to connect to the uart4 port of px4. But I checked the code and found \_report\_gps\_pos.heading = NAN; I wonder if the navigation of PX4 is solved by connecting two gps ports (eg. gps1 uart4)?

 ![4314682884](https://discuss.px4.io/uploads/default/original/3X/d/4/d48a173962e6b31184256015b10c9de001a73a85.png)

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [June 6, 2025, 3:02am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/2 "2025-06-06T03:02:28Z")

</div>

The line you highlight is just the “reset” of the heading. The actual heading is set somewhere else. In order not to have stale heading data, it’s reset to NAN again immediately after. It’s a bit confusing and doesn’t help with logging the data.

What sort of GPS is this? Knowing more usually means that we can actually help you, rather than just talk in the abstract.

---

<div class="post-metadata">

**Author:** ![trace\_lussy](https://discuss.px4.io/user_avatar/discuss.px4.io/trace_lussy/32/19616_2.png) [@trace\_lussy](https://discuss.px4.io/u/trace_lussy)\
**Post date:** [June 9, 2025, 1:38pm UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/3 "2025-06-09T13:38:12Z")

</div>

![2025-06-09 20-09-12 的屏幕截图](https://discuss.px4.io/uploads/default/original/3X/2/4/24ab65b55fc255180076b10ae357e9b777929e92.png)  
I am using this GPS, it can send multiple NMEA type data such as GPGGA GPGSA GPRCM etc.  
 ![2025-06-09 19-24-00 的屏幕截图](https://discuss.px4.io/uploads/default/original/3X/e/3/e3762b42bfe58459bd742a18b585f8ec19e02d6c.png)  
I successfully obtained the latitude and longitude information and their variance, but the values ​​of rate reading, rate position, rate velocity, rate publication and rate RTMC injection are all 0. I don’t know what the problem is.Do you have any idea? Thanks a lot！

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [June 11, 2025, 2:10am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/4 "2025-06-11T02:10:36Z")

</div>

I’m not so sure. What I can see is that there is not really a GPS detected. It says UBX but “not ok”, so presumably, it’s still searching. What module is it under the hood, and what protocol does it talk? You mention NMEA? If you set the protocol to NMEA using the [param GPS\_1\_PROTOCOL](https://docs.px4.io/v1.15/en/advanced_config/parameter_reference.html#GPS_1_PROTOCOL), does that help?

My hunch is that PX4 doesn’t really have support for this module.

---

<div class="post-metadata">

**Author:** ![trace\_lussy](https://discuss.px4.io/user_avatar/discuss.px4.io/trace_lussy/32/19616_2.png) [@trace\_lussy](https://discuss.px4.io/u/trace_lussy)\
**Post date:** [June 11, 2025, 2:34pm UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/5 "2025-06-11T14:34:57Z")

</div>

HI!  
I have successfully transferred the GPS data to PX4. But there is a problem, I don’t know if the navigation is correctly transferred to PX4, because in the GPS\_RAW\_INIT message, the yaw data is 0

 ![2025-06-11 22-27-25 的屏幕截图](https://discuss.px4.io/uploads/default/original/3X/f/4/f4009f475e5341b48d0bf178caf9e18c05ddf070.png)  
This picture should show that my GPS is correctly configured：  
 ![2025-06-11 22-30-06 的屏幕截图](https://discuss.px4.io/uploads/default/original/3X/f/c/fc564419b164d6d57f59f8828bb095d2f4c07324.png)  
There is a small phenomenon：On the QGC client,Course Over Ground(COG) keeps jumping.  
 ![2025-06-11 22-34-15 的屏幕截图](https://discuss.px4.io/uploads/default/original/3X/6/6/667e23ad739f22078c332089ae2ef4e443afcc37.jpeg)

---

<div class="post-metadata">

**Author:** ![trace\_lussy](https://discuss.px4.io/user_avatar/discuss.px4.io/trace_lussy/32/19616_2.png) [@trace\_lussy](https://discuss.px4.io/u/trace_lussy)\
**Post date:** [June 13, 2025, 6:23am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/6 "2025-06-13T06:23:34Z")

</div>

I have another question, how can I view the positioning results after EKF fusion?

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [June 16, 2025, 12:40am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/7 "2025-06-16T00:40:50Z")

</div>

You likely have to make sure a few more of the fields are valid, e.g. eph, epv, etc. for it to work properly with EKF2. Best to check the EKF2 code to see what it uses.

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [June 16, 2025, 12:41am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/8 "2025-06-16T00:41:11Z")

</div>

Look at the local\_position and global\_position topics.

---

<div class="post-metadata">

**Author:** ![trace\_lussy](https://discuss.px4.io/user_avatar/discuss.px4.io/trace_lussy/32/19616_2.png) [@trace\_lussy](https://discuss.px4.io/u/trace_lussy)\
**Post date:** [June 23, 2025, 2:35pm UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/9 "2025-06-23T14:35:08Z")

</div>

Hello! With your guidance, I have successfully obtained all the data information, but when I use rosbag to record mavros topics /mavros/global\_position/compass\_hdg, /mavros/global\_position/global and /mavros/global\_position/local, I find that the data flow is sometimes there and sometimes not. What is the problem? I really need your help!

 ![2025-06-23 22-34-40 的屏幕截图](https://discuss.px4.io/uploads/default/original/3X/0/a/0a4ce8f28f051935280ccd9263a7e6f5a3482169.png)

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [June 25, 2025, 11:24pm UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/10 "2025-06-25T23:24:11Z")

</div>

That’s probably just logging drops. Are you using a fast SD card?

---

<div class="post-metadata">

**Author:** ![trace\_lussy](https://discuss.px4.io/user_avatar/discuss.px4.io/trace_lussy/32/19616_2.png) [@trace\_lussy](https://discuss.px4.io/u/trace_lussy)\
**Post date:** [June 27, 2025, 6:15am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/11 "2025-06-27T06:15:45Z")

</div>

The problem seems to be that when the horizontal velocity is unstable, it will cause local position errors and global position errors. At this time, MAVROS will not send GLOBAL\_POSITION\_INT messages. Therefore, when I use rosbag record, I cannot record these topics.

---

<div class="post-metadata">

**Author:** ![system](https://discuss.px4.io/uploads/default/original/3X/7/3/73ce918bdcd64854de904f0c8d9ab70ca9723f2a.png) [@system](https://discuss.px4.io/u/system)\
**Post date:** [September 25, 2025, 6:16am UTC](https://discuss.px4.io/t/heading-in-gps-data/45902/12 "2025-09-25T06:16:36Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
