Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate Cross-Track error (GPS/Core Location)

Tags:

xcode

ios

iphone

Does anyone know how to determine determine the "Cross-Track Error"?

For those who are unfamiliar: You are driving along a line from Point "A" to point "B". When in transit, when you veer off that line, the distance from your current position to the line is the cross-track error.

I have a simple algorithm now which works, using basic geometry with the latitude and longitude of the three points - the problem is that it does not take "great circle" calculations into account (i.e. actual meters-per-degree longitude varies depending on your latitude, and does not equal that of the latitude).

In other words - if you know of a "great circle" formula for determining this, please let me know - but it is not a straight Cartesian geometry problem.

like image 340
Brad Avatar asked Oct 22 '10 13:10

Brad


People also ask

How is cross track error calculated?

The simplest way to do this is to calculate the distance to every point on the outbound path from every point on the return path. For each point on the return path, the distances are sorted, and the shortest distance is taken as the XTE for that point.

What is cross track error?

“Cross Track Error (XTE) is the distance that vessel is off the course either to port or starboard. It is usually caused by drift due to environmental factors. Those involved in maritime operation will understand how important it is to be aware of XTE, as it is at the core of corrective action.”

What is cross track distance?

Cross-track distance (XTD), is set to a number of meters on the port and starboard side of the dotted track line. The corridor can then be automatically checked in ECDIS for under-keep clearance. An alarm can also be set to sound if the vessel leaves the corridor. Source publication.


1 Answers

Brad,

I'm not sure which ellipsoid model you are using since you don't say. If you aren't using an ellipsoid model in you current calculations, you may find this helpful:

http://www.movable-type.co.uk/scripts/latlong-vincenty.html

The Vincenty algorithm is more accurate that the Haversine algorithm.

Once you have accurate distances for A-B, A-C and B-C, it should be straightforward to determine your distance from C to the line A-B. Something like a binary search of the distances from points on A-B to C, looking for the shortest value.

James

like image 114
James Branigan Avatar answered Sep 24 '22 17:09

James Branigan