First we calculate the size in meters of a degree at our current locations. There are several equations around the web that pretend to describe how this should be done. Unfortunately, they all give slightly different results and since I am using Google Earth as ground truth, I decided to instead estimate these values from the maps in Google Earth around my current location. It turns out that where I am, the length of a degree of latitude is 111116 meters and the length of a degree of longitude is 62740 m. Armed with these values and a location that we want to use as origin, we can transform any location into our new coordinate system where will will use the variables x and y instead and measure distances in meters.
The simplest way to make the calculations comprehensible is to convert the latitude and longitude into decimal degrees. We may also set the signs so that N and E are positive and S and W are negative. This is done in the following way:
lat_dec = lat_deg + lat_min / 60 (for N)
lat_dec = - lat_deg - lat_min / 60 (for S)
long_dec = long_deg + long_min / 60 (for E)
long_dec = -long_deg - long_min / 60 (for W)
Here lat_dec and lat_min are the degree and minute part of the latitude. We can now easily subtract the origin and then multiply by the size of a degree to get the position in our new coordinate system
x = 62740 * (long_dec - long_dec_origin)
y = 111116 * (lat_dec - lat_dec_origin)
That's it. Now we have nice workable coordinates that can easily be used by the robot as long as it stays reasonably close to the origin. Once I figure out to do this correctly I will calculate the size of a degree in a way that makes the navigation valid everywhere on earth. For now, the robot will have to stay close to home.