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

EKF2: ellipsoidal earth navigation #23854

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

EKF2: ellipsoidal earth navigation #23854

wants to merge 8 commits into from

Conversation

bresch
Copy link
Member

@bresch bresch commented Oct 25, 2024

Solved Problem

The current EKF evolves in a fixed local NED tangent frame with an origin set at boot. This works well for short and moderate distances but degrades when flying over long distances (>100km) as the tangent frame gets significantly further from the ellipsoid surface.

Solution

Mechanize the navigation equations using a local-navigation-frame which is NED-oriented and with its origin attached at the CG of the vehicle. The position state now defines the global position of the drone (geodetic Latitude-Longitude-Altitude) and the local position is constructed by projecting the global position using an arbitrary origin (initialized at boot or manually by the user).

The error-state is defined in a fixed local-navigation-frame to ignore all the -really small- pseudo-forces due to the frame rotation. This allows us to keep the covariance prediction really simple and unchanged from the previous local tangent frame approximation. The position uncertainty is also defined in the local NED which makes it more intuitive than latitude/longitude errors.

Note that the global position state is not directly included in the state vector from the derivation as lat/lon require double precision. The global position is stored in a new class LatLonAlt which contains operators to combine ellipsoidal position and Cartesian position errors (to compute position innovations and apply corrections).

When no latitude/longitude/altitude is available, the EKF assumes to be started at 0/0/0. This avoids having to handle multiple conditions everywhere in the code and the incorrect radii of curvatures is insignificant when navigating close to the starting location. It is then still possible to manually set the current position of the drone to automatically initialize the EKF at the correct location and continue dead-reckoning from there.

image

The position of the output predictor is considered as an error relative to the main (delayed-time EKF) and thus integrates the velocity and position directly on the Cartesian local-navigation-frame (origin at the LLA of the delayed-time EKF).
image

Changelog Entry

For release notes:

TBD
New parameter: -
Documentation: -

Alternatives

Test coverage

Context

@bresch bresch force-pushed the pr-ekf2_gpos_rework branch 4 times, most recently from d80e0d9 to 24730b8 Compare October 29, 2024 10:47
@bresch bresch requested review from haumarco and dagar October 29, 2024 10:48
@bresch bresch added the EKF2 label Oct 29, 2024
@bresch bresch force-pushed the pr-ekf2_gpos_rework branch 2 times, most recently from ecbd921 to f8ac1e0 Compare October 29, 2024 16:27
src/modules/ekf2/EKF/ekf.cpp Outdated Show resolved Hide resolved
src/modules/ekf2/EKF/ekf.h Outdated Show resolved Hide resolved
@bresch bresch marked this pull request as ready for review October 29, 2024 16:32
@bresch bresch self-assigned this Oct 29, 2024
@bresch bresch force-pushed the pr-ekf2_gpos_rework branch 3 times, most recently from f2ea77f to 3632f2e Compare October 30, 2024 14:40
The position error state is still defined in a body-fixed NED frame but the
position state itself is latitude-longitude-altitude.
Flow only provides velocity information
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

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

Nice!

The height definitions in mavlink is based on AMSL, which are defined by a geoid.

Wouldn't this have implications in the current navigation stack where it doesn't distinguish ellipsoidal or geoid heights?
The GPS returns both, but I couldn't find where this would be explicitly distinguished.

@bresch
Copy link
Member Author

bresch commented Nov 4, 2024

Wouldn't this have implications in the current navigation stack where it doesn't distinguish ellipsoidal or geoid heights?

@Jaeyoung-Lim You're right, it's not ideal but we still use AMSL everywhere so it's at least consistent on the altitude reporting side. A current issue is that we use AMSL instead of ellipsoid height in the calculations inside the LatLonAlt class.
My goal is to only use ellipsoid altitude inside EKF2 and then convert the output to AMSL. We currently don't have a geoid model, so either we add one or we continue to steal it from the GNSS receiver (i.e.: compute the difference between reported AMSL and ellipsoid alt).
This PR is however large enough so I'll do the changes in a follow-up one.

@Jaeyoung-Lim
Copy link
Member

Jaeyoung-Lim commented Nov 4, 2024

@bresch Thanks! I think this would be anyway a huge improvement in navigation performance, especially when you care about altitude above terrain.

Last thing I would like to comment (For myself really) is that this would probably break the gazebo gps plugin setup, since gazebo assumes a cartesian world. I have a separate gps sensor plugin that considers the simulated world as the projected surface on the geoid to simulate flying in a CH1903/LV03 digital elevation map in Switzerland. We can probably adapt this to UTM coordinates for more general locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👀 In review/test
Development

Successfully merging this pull request may close these issues.

2 participants