Two weeks ago, I ordered myself a GPS system. More specifically, I picked the Garmin Nuvi 350, which is NOT a traditional GPS, but a Personal Navigation System. I was mildly disappointed that it did not support the saving or dumping of raw GPS data. After playing with it, and figuring out the basic hacks for it within a few days (I was fully up on it by Thursday, got it on Tuesday) I acquired a "straight GPS" from my buddy Erik. The second device is a Delorme Earthmate USB. This thing is great, and like many devices, has better support in Linux than it does in Windoze.

I got GPSDrive working, talking to gpsd, along with a horribly written BASH script that I fat fingered and failed me this morning. Here's the corrected one:

# $HOME/GPS/scripts/
# author: Me!
# last updated: Mon Jul 07 07:19:56 EDT
# abstract: Polls gpsd and sends results to brightkits
# this script is NOT pretty, but it's commented

# start gpsd as root
sudo gpsd -n /dev/ttyUSB0

# create directory for this run's data and define files
DATE=`date +%y%m%d-%H%M%S`
mkdir ~/GPS/$DATE

# poll gpsd every $INTERVAL minutes

# my shitty while loop

while [ $X -eq "1" ]
# poll gpsd with netcat and output to the nmea dump file
echo r | nc -i 3 localhost 2947 >> $GPSDUMPFILE
# convert the nmea data to simpler gpsdrive data
gpsbabel -i nmea -f $GPSDUMPFILE -o gpsdrive -F $GPSDRIVEFILE
# sample most recent result
# for debugging, echo the result to the terminal and read the result
# with festival
echo '(SayText "Uploading current location to bright kite dot com '$CURRENTRESULT'")' | festival --pipe
# create the file that will be mailed
# mail the file with mutt (keep in mind that your .muttrc will be
# used for this
mutt -b < $RSLTFILE
# i know... bash can do this, but i used bc :-P
sleep `echo "$INTERVAL * 60" | bc -l `

# the script is just killed by a C-c

I know, it's not pretty at all, but it works (I think... I only missed the "@" symbol last night in the $RSLTFILE, but I was tired.

Check my twitter and brightkite feeds around 1600 today, and it should be working :-)


Newer Post Older Post Home