GPS Geekery
At the weekend we drove from Kaiserslautern to Köln and back, and I used the OpenMoko FreeRunner as a GPS tracker on the way. It worked impressingly well, it got a fix in about a minute happily tracked for nearly 6 hours without charging the battery. The TangoGPS logging left me with a text-file with about 10500 entries of gps coordinates, speed, heading and time. TangoGPS is great on the openmoko, but it's not very feature rich when it comes to looking at the logs later. You can load them, and see them on the map, but that's it.
There is a tool called gpsbabel which can convert these logs to other formats for GPS logs, and this let me convert my logs to .kmz files and again view them, now in Google Earth. However, what I really wanted was a bit more analysis, at least giving me average speed, etc. Mainly I was looking for an explanation why the car used more petrol on the way home than going out.
A quick googling brought me nothing, so I brought out R, which I've not really touched since finished the PhD. The syntax of R really hasn't improved since last time, it still feels like it's cobbled together by very talented and intelligent people, but people who never saw a real programming language before. Anyway, R had a bit of trouble plotting the 10,000 data points, at least quickly enough for my taste. To reduce the data I learned a new '''awk''' trick, and '''cut''' that I discovered last week:
cat tangogps.log | awk 'NR % 4 == 1' | cut -d, -f 4,7
This will print only every 4 lines, and only the speed and date. (In retrospect it would perhaps have been much easier to do this in R). Now finally, loading it into R I could find out that my average speed was 22 km/h. I couldn't quite stop there though, so I spent nearly an hour plotting some things:
Speed driving from Kaiserslautern to Köln:
(Note the 45 minutes spent standing still at the end because of damn FCK playing on Friday night)
And for completeness, the other way:
In the end I learned nothing, I drove slightly faster going there, so I should have used more petrol that way. Perhaps the head wind was stronger going back? A shame Kaiserslautern is south of Köln, otherwise the explanation would of course be that driving 'downhill' uses less petrol…
Now this is perhaps getting a bit too geeky even for me.