# NavigatorPage

## From Raw GPS

GPS coordinates are spherical: Latitude, Longitude and distance from the center of the earth (or altitude above mean sea level). Angle measurements are given in either decimal degrees or degrees, minutes and seconds. This paper assumes use of decimal degrees. Local maps are in two dimensions; the Earth is locally flat. We will assume that the robot is operating in a small enough area where the curvature of the Earth is not significant. We will pick an origin for a local map, and measure distances in meters. The positive X-axis measures distance east from the origin and the Y-axis gives distance north. Compass direction uses 0 degrees as north, 90 degrees as east, 180 as south, and 270 as west. Compass direction will be referred to as “bearing”. It differs from the “angle” of a standard coordinate system in which 0 is east and 90 is north. angle = 90 - bearing

There are sophisticated algorithms to find the great circle distance between two (latitude, longitude) readings. These algorithms are good for plotting airplane flight paths, but they do not apply to local navigation. With the flat earth assumption, conversion between the two coordinate systems is simple.

x = EARTH_RADIUS * (Longitude – LONGITUDE_ORIGIN) * (π / 180) * cos(LATITUDE_ORIGIN *π /180) y = EARTH_RADIUS * (Latitude – LATITUDE_ORIGIN) * π / 180 z = EARTH_RADIUS Latitude = (y * 180) / (π * EARTH_RADIUS) + LATITUDE_ORIGIN Longitude = (x * cos(LATITUDE_ORIGIN *π /180) * 180) / (π * EARTH_RADIUS) + LONGITUDE_ORIGIN You should set the origin to be near the center of the area in which you intend to operate.

Example: using Seattle Center House as the origin LATITUDE_ORIGIN = 47.6213 LONGITUDE_ORIGIN = -122.3509 EARTH_RADIUS = 6371000 A reading of (47.620941, -122.351206) is 22.934 meters west of Center House and 39.918 meters south. A point 151.77 meters east and 66.16 meters north is at (47.621895, -122.348875).

Note that measuring distance to a centimeter requires about 7 places beyond the decimal point in latitude and longitude. Thus latitudes and longitudes should be stored as 64 bit doubles. If your processor (such as the Arduino) does not have this capability, an alternative is to record distances in mm as a 32 bit long integer, which will provide a range of 2147 km from the origin. If you travel that far, the flat earth assumption is no longer valid, and you are on a new map with a new origin. GPS is not sufficiently accurate for robot navigation. It typically has a standard deviation of 3-5 meters, which would mean that it can drift by 15 meters. Even if you achieve a 1 meter standard deviation, you do not have enough accuracy to keep a vehicle in its lane. The GPGGA format includes latitude, longitude, time and Horizontal Dilution of Precision (HDOP). The standard deviation of the GPS reading can be estimated as

sigma = sqrt((3.04*HDOP)2 + 3.572)

GPS can be further degraded by multipath reflections from buildings. It may become unavailable indoors, in tunnels, or if satellites are not properly positioned. Latitude and longitude coordinates are available from Google Earth, Google Maps, and OpenStreetMaps. Open Street maps lets you download the positions of streets and buildings in latitude and longitude coordinates precise to seven decimal places. Thus you can construct a map of your robot's expected environment.

-- Main.JosephBreithaupt - 2017-07-06

NEXT > HighLevelSWv3