Skip to content
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

AP_GPS: Fix undulation incorrect convention #29200

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented Jan 31, 2025

Purpose

Fixes #29199

Tests performed

Ground and flight tested on UBX, I would like to request help from the community on checking other GPS's.

TODO

  • We should fix/clarify the comments in get_undulation and spread across the code. The language is either incorrect or imprecise.
  • Get other users of GPS's to test this patch - you only need to power on your vehicle, get GPS lock, and send me a BIN and TLOG.
  • Consider an autotest and starting to simulate MSL/ellipsoid differences in SITL
  • Add documation to the dev wiki on conventions for writing a GPS driver?

* And some drivers likely reporting the wrong ellipsoid height in
  GPS_RAW_INT

Signed-off-by: Ryan Friedman <[email protected]>
@Ryanf55 Ryanf55 added the GPS label Jan 31, 2025
@Ryanf55 Ryanf55 requested a review from hendjoshsr71 January 31, 2025 01:10
@Ryanf55 Ryanf55 added the BUG label Jan 31, 2025
@Ryanf55 Ryanf55 requested review from tridge and peterbarker January 31, 2025 01:42
Copy link
Contributor

@tpwrules tpwrules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested yet. Needs some more sign flips:

if (gps.get_undulation(undulation)) {
pkt.height_ellipsoid_mm -= undulation*1000;
}

float undulation;
if (current_location.get_alt_cm(Location::AltFrame::ABSOLUTE, alt_amsl_cm)) {
altitude_geodetic = alt_amsl_cm * 0.01;
}
if (gps.get_undulation(undulation)) {
altitude_geodetic -= undulation;
}

position.alt_ellipsoid = position.alt_msl - undulation*100;

I wonder if we should rename dataflash GPA.Und to make it clear that the sign has changed for any tools which depend on it. Perhaps GPA.UndC for conventional, and possibly keep the old one? I would also support removing it and/or adding an ellipsoid height. Not sure dataflash compatibility is super important.

@tpwrules
Copy link
Contributor

tpwrules commented Feb 4, 2025

Tridge says:

  • need to change dataflash name
  • could log both, would prefer not to since the existing one is unexpected

NOVA driver might be wrong too, need to test

@tpwrules
Copy link
Contributor

tpwrules commented Feb 4, 2025

From page 245 of (an archived copy of) the NOVA protocol document om-20000129.pdf mentioned in the header:
image

The illustration matches Wikipedia and NMEA and is opposite the convention currently in ArduPilot, so the undulation received from the NOVA is almost certainly wrong. If so, this would make a pretty clear case that ArduPilot's convention is backward because it would make all drivers negate the quantity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AP_GPS Undulation is opposite common convention causing incorrect ellipsoid height
3 participants