RTK and general GNSS inaccuracies

Happy new year, everyone!

I went through EKF3, traced the location update and populated the inner workings in the previous, aggregate post.
Please correct me if I have misunderstood any part of it.

The inner position state and output are expressed in NED and in meters, in float32. This means that there is plenty of resolution to accept RTK accuracy, being a bit conservative to account for flat-Earth modeling.

However, the GPS location is read from the GPS driver as the well-known int32_t degree*10^7 representation which kills all resolution below 11cm.
From my point of view, if somehow the GPS drivers could offer higher resolution, the EKF could happily oblige and produce better results.

One more thing: During the measurement update, the used position accuracy is set to:

float alpha = constrain_float(0.0002f * (lastTimeGpsReceived_ms - secondLastGpsTime_ms),0.0f,1.0f);
[...]
gpsPosAccuracy *= (1.0f - alpha);
float gpsPosAccRaw;
if (!gps.horizontal_accuracy(gpsPosAccRaw)) {
    gpsPosAccuracy = 0.0f;
} else {
    gpsPosAccuracy = MAX(gpsPosAccuracy,gpsPosAccRaw);
    gpsPosAccuracy = MIN(gpsPosAccuracy,100.0f);
}

meaning that, depending on the size of gpsPosAccuracy its value may overshadow a better RTK accuracy.

On the other hand, if gpsPosAccuracy is actually smaller than the actual RTK accuracy, then the truncated RTK values, there is a mismatch between the final measurement uncertainty gpsPosAccuracy and the actual resolution of the GPS position.
This may result in an underperforming filter.

Of course, all of the above is probably already known to the EKF developers, but it was a good exercise for me and a piece of documentation I could not find elsewhere.

3 Likes

@mboland
Do you know if a dev could weigh in on this and give an opinion on how much of what I have written is true and how easily RTK precision could be added in the EKFs?

I have a friend whoā€™s doing GIS professionally and is interested in it.

Iā€™m not a developer, but @WickedShell might be able to weigh in on this. Iā€™m guessing most of what you say is true, but I canā€™t say for sure.

In my opinion, improving the EKF accuracy down to the sub decimeter level would be neat, but most vehicles wouldnā€™t respond a lot differently due to other navigational inaccuracies (tuning, etc.).

Since most of us who us GNSS for GIS and surveying conduct post-processing, I donā€™t think thereā€™s much advantage to real-time position estimates by the EKF anyway. Post-processing will probably always win because reliance on a wireless link for real-time corrections isnā€™t as good. Post-processing can also have custom filtering, data manipulation, etc. Since logging and post-processing already narrows us to sub-cm accuracy in many cases, I donā€™t think it matters if aircraft are a few cm off in their navigation routes.

In general, I donā€™t think many users have an interest in hitting the same 3-cm point every time with their vehicles. I guess rovers conducting lawn-mowing and precision navigation could benefit.

Only the Devā€™s that have had input to this discussion
@WickedShell
@Michael_Oborne
@OXINARF

At least you have highlighted that there is good decimal accuracy that is being truncated from float32 to int32_t in the code.
It seems good practise to me that it should remain float32 throughout to provide at least consistency.

1 Like

@Naterater I am mowing and would like to see the accuracy greater. My tuning is not quite what it should be yet, so I certainly would not say any inaccuracy in my navigation is really due to the 11cm limit. But, it would just be nice to know that this one variability was eliminated.

Well, even if you want to to offline processing, donā€™t you need to have a log of the onboard RTK receiver somehow somewhere, correlated with Roll-Pitch-Yaw values?
Where is this captured right now? On an SD card in the receiver? Not 100% informed on this topic.

And one other thing, for which Iā€™m in the dark: What about indoor navigation, with small quads etc.
Is the same resolution truncation happening for UltraWideBand positioning sensors as well?

Most survey-grade GNSS units have separate on-board logging of the GPS data from the flight that can be post-processed. The easiest way is without lever-arm corrections (keep the GPS directly above the camera), however when the GPS moves a lot relative to the camera, then the lever-arm offsets can be a little more important and then are extracted and estimated from the autopilot logs. Roll-Pitch-Yaw are generally discarded as modern photogrammetry software uses automatic triangulation anyway. If you want to read-up on an inexpensive system that does this, Emlid has a good amount of basic information. https://docs.emlid.com/reachm-plus/common/tutorials/ppk-introduction/

The truncation of some of these EKF items is actually a little concerning, especially for more precise applications like optical flow and as @Georacer said, indoor navigation.

1 Like

So, I need straightening out on one thing. Is the current precision in the navigation routines of Ardupilot (not logging) 11 cm or 11 mm? Here https://github.com/ArduPilot/ardupilot/issues/5287 and the wikipedia article https://en.wikipedia.org/wiki/Decimal_degrees it refers to say millimeters. In this thread, I see centimeters. That should be at the equator for longitude and everywhere for latitude, I believe. Longitude gets more accurate as you move away from the equator.

mm or cm ???

Hi @ktrussell,

Sorry for not noticing your message earlier.

The resolution for the current representation of position for the EKF is a floating-point value in meters (source code link). This is equivalent to sub-millimeter resolution for a typical range of 1000m.
Its precision cannot be easily quantified, as it depends on the precision of many sensors, such as the GPS, accelerometer, gyroscope and others.

However, the GPS precision is a major contributor of inaccuracies, and its own representation is an int32 value in degrees (lon/lat) * 1E7.
The minimum increment which can be recorded is an angle of 0.000001 degrees. Projecting this to meters gives us:

Ī”x = sin(Ī”Īø)*Re = sin(Ļ€/180 * 0.0000001) * 6.3781e6 = 0.0111 meters

It seems I had missed a decimal place in my earlier post, I apologize.
Thank you for reviewing my post.

Thank you George for the excellent explanation that clears up my understanding completely. A silly thought: the precision will be greater for longitude as you move further from the equator, so planning a mowing pattern that runs north-south rather than east-west would theoretically allow one to have more precision between passesā€¦ My mower isnā€™t tuned that well yet, anyway. I overlap by 20".

I would throw my hat in the ring of hoping the developers find the time to increase the precision at some point, though.
Thanks again!

I donā€™t think your first and second statements agree. Is there a zero missing somewhere? 0.000001 degrees is roughly 0.11m, not 0.011m according to Wikipediaā€™s table.

Sighā€¦ There is definitely a zero missing somewhere, I have given two different numbers for minimum angle increment in my last post. Sorry I messed up again.
Letā€™s use the scientific notation to avoid further typographical errors.

So, as we know, the GPS subsystem of Ardupilot reports coordinates in units of degrees*1e7.
This information is conveyed in an int32 variable.

Thus, the minimum increment which a coordinate value can change by is as large as a unit in the least significant digit.

Now, letā€™s take this really slow so that I donā€™t make a mistake again.

  • 1e7 units are read as 1 degree (in latitude or longitude)
  • 1 unit (the minimum possible increment of the reported coordinates) is read as 1e-7 degrees.

So, doing again the above math we get:
Ī”Ļ‡ = sin(Ī”Īø)*Re = sin(Ļ€/180 * 1e-7) 8 6.3781e6 meters = 0.0111 meters.
which is the same as my previous derivation (thankfully).

Sorry for another late answer. I have so many notifications on discord that the replies get lost in the clutter.
Try PMing me if you really want to get through to me in time.

Have a nice day!

While I agree that the resolution of reported longitude and latitude is greater at greater latitudes (and consequently the precision as well), I donā€™t see how north-south passes could be more accurate;
The local resolution of the GPS subsystem (i.e. the flat plane of land you mow) is constant.

Yes, in high latitudes, longitude has more resolution (in meters). I found this image from wikipedia to have a nice visualization:

However, by doing north-south passes you would trade accuracy in one direction for the other (east-west). I donā€™t see how it would help.

Still, by now you must have a very well-trimmed lawn, considering 20" overlap :smiley:

@Georacer
My thinking is that if I mowed in an up and back pattern north and south that my distance between each line would be more precise. What would still have the latitude error, which is larger, would be the end points where the mower turns around, e.g. the mower would turn around at different latitudes. It is all kind of academic I guess anyway. (And I prefer to mow in a polygonal shape from outside in, anyway. )

1 Like

After the release of the ZED-F9P, cm-level reliable positioning is here without spending thousands of $$$$. How much effort does it take to have navigation to the cm-level in ardupilot? Is this simply changing the format of a few variables to remove the truncation, or is this far more involved? Moving-baseline heading is now very accurate, but navigation still suffers.

The Zed-F9P version from Ardusimple is purposely built for the Ardupilot world. So that, and it being the lowest cost version so far, is why I chose it. It has the JST connectors already on the board. Note: I do not sell these. :slight_smile:
It has XBEE connectors already on it, too. I chose the 900 MHz versions for comms between the base unit and the one(s) on the drone(s.) It also (probably) does not interfere with most control comms between the drone(s) and the controllers.

Personally, I -do- need accuracies of 1-3 mm, both for the drones and for the lawnmower. There is a slope on the lawn that meets directly with the curb to a heavily traveled road. <noisy, too! Sigh> I always feel like Iā€™m going to tip over onto the road for about 70 feet of that section. As the Ardupilot code stands right now, I cannot trust the controller to prevent the lawnmower from simply steering itself onto that road. (The wheels have to actually ride on top of the curb.) Some of that mission -may- be solvable with CV; just not sure.

More importantly, I need the flying drones to locate themselves, and report their locations, as accurately as possible. GPS stamping the photos is a whole separate issue but AFAIK that data does not come from the Cube, so Iā€™m setting the companion up to feed the camera.

Help, please!
Thanks.

David,
Iā€™m curious what type of mower you have that you can get very close to a curb reliably from a mechanical point of view? I may not be understanding what you mean, actually. But, with my large Zero Turn, I have come to realize that it will never cut close to some objects, at least without a LOT of precision mission planning. The frame of the mower is so large relative to the deck that the direction it approaches a particular feature of the yard can make a difference in how much it goes past my desired point. I hope one day to build a more nimble, likely electric, version for closer cutting around obstacles.
I would love to see your machine if you have videos or pictures. Sounds like you are doing good things!
Kenny

Kenny,

  Kubota BX 2660 with the 60" cutting deck.  Probably all over the

web. :slight_smile:

David

2 Likes

I plan to include 3D vision on it as well, like the Intel D435 or 435i. Or maybe, finally have a use for my jetson TX2 since it has six lanes of MIPI video input. :slight_smile: LIDAR might be in itā€™s future, too.

Or is that getting over the top? :slight_smile: Toys, toys, toys!

1 Like

Iā€™m quite certain that APā€™s accuracy can be 1cm (or better) and that the conclusion that it can be no better than 11cm is incorrect.

I guess there are various places where the accuracy could be lost:

  1. GPS driver ā€“ thereā€™s no loss of precision as we convert the incoming packets into int32 lat and lon values. This gives 1cm accuracy
  2. EKF estimation ā€“ the 32-bit float values are offsets from the EKF origin not lat/lon values. If the vehicle is within 100km of the EKF origin (recorded soon after startup) its accuracy is better than 1cm. Recently the ā€œExtreme ArduPilotā€ project has increased the EKFā€™s use of doubles so now even beyond 100km the accuracy can be better than 1cm
  3. MAVLink communication between autopilot and ground station. This would affect reporting and/or the ability to set a waypoint target lat/lon value. For waypoints at least, int32s are used which gives 1cm accuracy. There are very old messages that used floats for sending waypoints but these are mostly not used nowadays.

FYI @tridge, @priseborough

1 Like