Coordinate Systems (Where in the world is your robot?)

by on February 24, 2014

coordinate frames

Hi all
There are many ways of expressing your position in the world. We can use those same methods to represent where in the world your robot is. At the highest level there are two types of coordinate frames; global and local. In the global frame the robots position is specified based on a pre-established method that can uniquely identify the robots position on earth (or any other planetary body/location). In a local frame you will assign some point as the origin,this is often the robots starting point or some fixed landmark. Once you have an origin defined you can just specify how far you are form the origin. For example if the robot drives forward 1 meter you can say it is at (1,0), and then if it travels to the left you can say that the robot is at (1,1). If you are dealing with 3D space you could rewrite those as being at (1,0,0) and (1,1,0).

Right Hand Rule

One important thing to become familiar with is the right hand rule. In the right hand rule you put your right hand straight out in front of you extending the middle finger towards the sky. You then stick your index finger all the way out pointing forward, and your thumb pointing to the right. Each of your fingers now represents an axis as well as the positive direction of that axis. So for example to turn counter-clockwise you would be going in a negative direction , and to turn clockwise would be going in the positive direction. You can then roll, pitch, or yaw your hand to determine the sign of the motion. For example pitching your index finger towards the sky would be a positive pitch, and rolling your thumb to the sky would be a negative roll. By convention the index finger is the y direction, the thumb is the x direction , and the middle finger is the z direction.

While I (and many others) prefer the right hand rule, you could follow a left hand rule and just reverse what I said above.

Global Coordinate Frames

Latitude, Longitude, Altitude/Elevation (lla)

map lat long
Latitude and Longitude is probably the most widely know global coordinate system and the one used by GPS to report position. This system specifies a position by the angular distance from a central ellipse (such as the equator). The latitude gives north <-> south position with the equator being 0, the north pole being 90 degrees, and the south pole being at -90 degrees. The longitude gives the east <-> west position relative to the prime meridian (approximately London) which is at 0 degrees , eastwards (North & South America) being towards negative 180, and westwards (most of Europe, Asia, Africa, and Australia) approaching positive 180. Sometimes instead of using positive and negative signs they just add a W, E, N, or S to the number corresponding with west, east, north, and south. The elevation (or altitude) is usually reported in meters.

There are two common ways of expressing latitude and longitude; degrees-minutes-seconds (DMS) and decimal-degrees. There are many online calculators for converting coordinates and wikipedia has some psudo code.

New York City (decimal degrees) = 40.67°, -73.94°, 10 meters
New York City (DMS) = 40°40’12” N , 73°56’24” W, 10 meters

Universal Transverse Mercator (UTM)

UTM america map

Map showing UTM zones of the continental USA with the associated longitude on top (from Wikipedia).

UTM is one of my favorite ways of expressing global position within a “small” area. In UTM the world is divided into 60 segments each representing 6° lines of longitude and then flattened. By flattening the world in these bands we can assign a coordinate to each point with an easting and northing value specified in meters and the hemishphere that you are in (North or South). So to express your position you can give the zone and the hemishphere of your position, and the easting, the northing position within that zone. You can also specify altitude in meters similar to the latitude/longitude system.

While this sounds complex, and has these “zones” that you need to worry about, UTM is nice since if you know your position and a goal position you can just subtract the easting positions from each other, and the northing positions from each other to figure out the distance you need to travel. Conversely if you want to travel somewhere, it is easy just to add the meters to your position, and get the global coordinates. This is much easier then working with lat/long where it is difficult to determine your position without resorting to a reference/calculator.

If you need to operate and cross between UTM zones you might consider using Latitude and Longitude for global decisions, and then use UTM for the “local” coordinates that the user interacts with.

New York City (Zone Hemisphere Easting Northing) = 18N 589591.5 4502665.1

Military Grid Reference System (MGRS)

utm mgrs map

Map showing UTM and MGRS zones (from Wikipedia).

MGRS is based on UTM but utilizes finer zones, and from the position you can determine the resolution of the position. So each zone is still 6° wide, but instead of being very long each zone is only about 8° tall. Each 6° segment has the UTM numeric zone and each 8° segment has a letter assigned to it. So a full zone designator could be 18F. This gets followed by a 100km identifier (each zone is broken into 100km blocks), and then an even number of digits from 0-10, corresponding to 100km (with 0 digits) to 1m (with all 10 digits). The first half of those 10 (possible) numbers are the easting position, and the second half of those numbers is the northing position. The more digits that are specified represents a higher resolution in position.

New York City (Zone designator EastingNorthing) = 18T WL 8959102665 (often expressed with no spaces)

Earth Centered, Earth Fixed (ECEF)

ecef map

Map of ECEF coordinates (from Wikipedia).

ECEF is an interesting idea for representing your position on a planetary body. In this method the coordinates are expressed in a 3D cartesian coordinate system, where the center of the earth is the (0,0,0) point. Depending on who you are, and where you are from determines whether those values are specified in kilometers or feet.

New York City (X,Y,Z) = (1340.218,-4655.49,4134.703)km

There is a nice tool and library from from the National Geospatial-Intelligence Agency (NGA) that can convert between multiple coordinate systems, and works in Windows and Linux. This can be used as a library to do the conversions for you within your software.

Liked it? Take a second to support David Kohanbash on Patreon!


Leave a Reply