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

NED location and GPS location are not strictly consistent #1855

Open
KeyneZzz opened this issue Mar 25, 2019 · 4 comments
Open

NED location and GPS location are not strictly consistent #1855

KeyneZzz opened this issue Mar 25, 2019 · 4 comments
Labels

Comments

@KeyneZzz
Copy link

KeyneZzz commented Mar 25, 2019

Yet another problem exposed after long flights. I am using NED location for navigation and GPS location for monitor, and I found that when endpoint was far from home position, the NED location and GPS location of the endpoint were not strictly consistent, which is obvious in ground station monitors. Any way to make it better? Thx

@KeyneZzz KeyneZzz changed the title NED location and GPS NED location and GPS location are not strictly consistent Mar 25, 2019
@DavidLSmyth
Copy link

If the distance is far enough the curvature of the earth may be responsible (equations that calculate the distance between gps coordinates takes the curvature of the earth into account). Do you have the figures outlining the inconsistency? Apologies if you've already ruled this out

@KeyneZzz
Copy link
Author

If the distance is far enough the curvature of the earth may be responsible (equations that calculate the distance between gps coordinates takes the curvature of the earth into account). Do you have the figures outlining the inconsistency? Apologies if you've already ruled this out

@DavidLSmyth thanks for your reply, and I am not considering the curvature thing.
My route is firstly heading north for 1.5 kilometer, then then turn to east for 1.3 km. When arrived, it's about 20 meters northeast from the set endpoint. The latitude is about 30 degrees.

@DavidLSmyth
Copy link

I did some of the calculations and as far as I could see there should be a small error in the gps location due to the non-planar geometry of the earth, the points are close enough to be considered on a plane. I'm not sure how the NED figures are calculated, it might be worth having a look at the source code. The calculation of GPS location is easy to find in the source code but it could be worth checking that too

@madratman
Copy link
Contributor

So, I did some digging:

the NED<->geodetic conversions are handled by EarthUtils::nedToGeodetic which you can inspect in https://github.com/Microsoft/AirSim/blob/123bbd6d6416bbe98e775101ba8ebcb5ccbf8501/AirLib/include/common/EarthUtils.hpp#L288-L304

Now, PawnSimApi.cpp uses the above EarthUtils::nedToGeodetic in two places:

Now, EarthUtils.hpp#L306 does mention " //below are approximate versions and would produce errors of more than 10m for points farther than 1km //for more accurate versions, please use the version in EarthUtils::nedToGeodetic", but they are for GeodeticToNedFast and nedToGeodeticFast (not the non-fast versions :)), which are not being used anywhere except in droneshell here
https://github.com/Microsoft/AirSim/blob/123bbd6d6416bbe98e775101ba8ebcb5ccbf8501/DroneShell/src/main.cpp#L1190
While, I haven't verified if GeodeticConverter::nedToGeodetic, we also have a function called ned2Geodetic in an unused header file in https://github.com/Microsoft/AirSim/blob/123bbd6d6416bbe98e775101ba8ebcb5ccbf8501/AirLib/include/common/GeodeticConverter.hpp#L128-L139
That might be worth a shot. So you can replace the calls of EarthUtils::nedToGeodetic in all the shebang I mention earlier with GeodeticConverter::nedToGeodetic and test that (or well, do the math heh)

Also, GeodeticConverter.hpp itself is based on another open source repo by ETH Zurich's Autonomous Systems Lab as can be seen in ethz-asl/geodetic_utils
An interesting thing to watch out is issue ethz-asl/geodetic_utils#28 , which seems to be accounted for in airlib in the following https://github.com/Microsoft/AirSim/blob/123bbd6d6416bbe98e775101ba8ebcb5ccbf8501/AirLib/include/common/GeodeticConverter.hpp#L136

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

No branches or pull requests

3 participants