-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Update TransponderReport.msg - correct "heading" description #25125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dakejahl - here it is, please review. |
I'm not sure that's correct, the SagetechMXS driver publishes heading as [-PI, PI] |
That's a good question to ask SagetechMXS driver's authors. Do we know it is working correctly? Because my code works fine, and when I tried wrap_pi() it didn't. You can play with it yourself:
There's also src/lib/adsb/AdsbConflict.cpp with its AdsbConflict::fake_traffic() method and comments suggesting atan2() - may be wrong too. |
This is how src/modules/mavlink/streams/ADSB_VEHICLE.hpp fills the MAVLink message:
These are also the values I see for heading in MAVLink Inspector when I drive my SIM lawnmower around. Heading is an int16_t field in MAVLink, all values above are below 65535:
src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml has many lines with cdeg type, After all, it's not how we fantacize about these fields, it's how well we feed QGC that matters... |
Oh, I think this actually makes sense. I think SagetechMXS may need to be updated to wrap into the positive range. I missed this in my initial consideration. The mavlink message expects a positive centidegree heading. However, the SagetechMXS driver outputs a range between [-pi, pi]. So currently TransponderReport can be in two different conventions depending on the source.
I think I can correct this by correcting SagetechMXS to use range [0, 2pi] and checking that it works. This way both cases the same positive-only range. And the docs can be updated accordingly. |
I'd suggest merging this PR first, if we've recognized that TransponderReport.msg comment needs correction. Then open a separate PR to deal with SagetechMXS fixing and testing. |
I made an error and did not fully address the issue with my commit. This was likely the two cases prior to #24780 fix:
|
@qtweng - this PR is strictly for fixing TransponderReport.msg comment, and maybe related documentation. Please deal with SagetechMXS issues in separate PRs. Thank you. Take it easy, my friend, the sunny side is that we haven't crashed into something heavy with 200+ souls aboard. Test it well :-) |
FWIW (just to be pedantic) If as driver is written to the uORB documentation then arguably it is correct, and the implementation of the MAVLink stream, which does not convert the uorb type correctly to match specification is what is incorrect. It doesn't matter really though, as long as all the authors agree and everything is changed to match. In particular because this isn't exported to ROS as well. https://docs.px4.io/main/en/middleware/dds_topics.html |
@hamishwillee - pedantic is my second name, welcome to the family! ;-) - and thanks for bringing this up. I have a feeling (not direct knowledge) that after the TransponderReport.msg is merged into main, some documetation will be auto-generated and thus updated. Let me know if I can help with docs otherwise. |
For documentation (auto?)updates watch https://docs.px4.io/main/en/msg_docs/TransponderReport.html |
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: https://discuss.px4.io/t/px4-dev-call-july-2-2025-team-sync-and-community-q-a/46266/1 |
You might not them until @mrpollo finishes his CI updates. I do these manually at the moment. It is very frustrating. |
Solved Problem
When TransponderReport message is published, the "heading" field must be filled with course over ground in aviation terms, 0..2PI radians (0 to 360 degrees). But the comment/description wrongly specifies -PI..PI range.
Fixes #24780
Solution
To fill "heading" field correctly, a wrap should be used - something like:
wrap_2pi(....gps_cog_rad)
Context
Please see discussion and example code in #24780