Append guidance course (navDesiredHeading) to MSP_NAV_STATUS#11665
Open
MartinovEm wants to merge 1 commit into
Open
Append guidance course (navDesiredHeading) to MSP_NAV_STATUS#11665MartinovEm wants to merge 1 commit into
MartinovEm wants to merge 1 commit into
Conversation
Contributor
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Collaborator
|
Hey @MartinovEm |
Append the nav guidance course/track (navDesiredHeading, centidegrees) as a u16 at the end of MSP_NAV_STATUS. It is the flight controller's own desired course output and is not derivable by a client (see PR description). It is an already-maintained exported global, so no new getter is added, and it is appended at the tail, so existing consumers that read the old 7-byte reply are unaffected. Also remove the long-dead commented-out target_bearing write.
e2a0a8c to
0d97d05
Compare
Author
|
Thanks @b14ckyy — done. Rebased onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Append one field to the end of
MSP_NAV_STATUS:navDesiredHeading(u16, centidegrees [0..36000)) — the nav controller's desired course/track.New layout:
u8 mode | u8 state | u8 activeWpAction | u8 activeWpNumber | u8 error | u16 headingHoldTarget | u16 navDesiredHeading.Appended at the tail, so existing consumers that parse the 7-byte reply keep working; new consumers read the extra 2 bytes only when the payload is long enough. No new getter —
navDesiredHeadingis already an exported global, set every nav cycle (wrap_36000(posControl.desiredState.yaw)). Also removes a long-dead commented-outtarget_bearingline in the same handler.Why this value specifically
navDesiredHeadingis the flight controller's own guidance output — the course it is actively steering toward — and a client cannot compute it itself:This is the one piece missing from MSP for a faithful desired-track / CDI / HSI course pointer.
Why the related values are deliberately omitted
Cross-track error, bearing-to-destination and distance-to-destination were left out on purpose — a client can already compute them: for a waypoint mission it downloads the mission (
MSP_WP) and derives bearing/distance/XTE from its own GPS position and the waypoint lat/lon (planar geometry; sub-metre precision is pointless at these ranges). In the no-waypoint modes there's no leg, so XTE/distance aren't even meaningful — only the course is.MSP_NAV_STATUSis polled often, so it's kept lean: expose only what the consumer cannot calculate.Note vs the existing field
The existing
u16 getHeadingHoldTarget()(bytes 5-6) is the commanded heading (heading-hold target). The newnavDesiredHeadingis the desired course/track toward the active leg — complementary, not a duplicate.Compatibility
Purely additive — appended at the tail, no existing field moved. Consumers should gate display on
mode/state(the value is stale when no nav mode is active).Testing
Built clean on INAV SITL with
-DWARNINGS_AS_ERRORS=ON.