Skip to content

Conversation

@peterbarker
Copy link
Contributor

Correct handling of ellipsoid and AMSL altitudes
from SBF receivers. Previously, undulation
was not applied properly, causing altitude
values to be reported as elipsoid only.

This is a slightly simpler version of #30971 which adds an epsilon check into the mix. Since this is a magic value we're looking for I think it makes sense to be a direct comparison.

@peterbarker
Copy link
Contributor Author

I've tested this on SBF here. We don't get ellipsoid height before, we do after. The reported altitudes are also much closer together after this PR is applied!

Same testing as done on the linked PR, same results. Broken before, fixed after.

Correct handling of ellipsoid and AMSL altitudes
from SBF receivers. Previously, undulation
was not applied properly, causing altitude
values to be reported as elipsoid only.
@tpwrules
Copy link
Contributor

tpwrules commented Jan 23, 2026

Do you have a sample point? Latitude, longitude, AMSL, alt ellipsoid. Would like to confirm the undulation is being processed correctly.

Also looks like lots of other places in the driver which should be migrated to use this function, if you have the hardware to test.

@peterbarker
Copy link
Contributor Author

Do you have a sample point? Latitude, longitude, AMSL, alt ellipsoid. Would like to confirm the undulation is being processed correctly.

Happy to supply logs (ping me). See the other PR for graphs made from logs. The general thing being that when this patch is applied all of the wiggly lines get much closer to the uBlox wiggly lines.

Also looks like lots of other places in the driver which should be migrated to use this function, if you have the hardware to test.

Just fixing the thing in front of me here.


static bool is_DNU(double value)
{
constexpr double DNU = -2e-10f;
Copy link
Contributor

Choose a reason for hiding this comment

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

DNU value is -2e10f .
image

@tpwrules
Copy link
Contributor

We might need a hex literal and a reinterpret_cast or something to avoid falling afoul of our "floating point consts are singles".

@tpwrules
Copy link
Contributor

Good news, -2e10 is the same as both a double and a float: https://godbolt.org/z/dMPsfv9x6 . Might be worth a comment to that effect. -2e-10 is not!

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.

LGTM, undulation values are processed correctly as confirmed with private data.

Consider the comment too.

@tpwrules tpwrules merged commit 98a9540 into ArduPilot:master Jan 26, 2026
114 of 117 checks passed
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.

3 participants