A small page to keep track of GPS handling within Linux
I have a nice Garmin eTrex Vista Cx GPSr (GPS receiver). It has a simple USB connection which works with modern tools. These instructions should work also for all Legend/Vista Cx/HCx devices.
GPSbabel
gpsbabel is the most powerfull tool I've found so far for handling data on the GPSr. I did not test all fancy things like waypoints, routes, etc. I sticked to simply downloading track from the GPSr to my linux box.
GPRs as a removable storage device
From the configuration menu of the eTrex GPSr, you can enable the UMS mode. This will enable your computer to access directly to the memory card on wich the device saves tracks as GPX files. The device creates one file per day, it's up to you to split embedded tracks.
GPSbabel with GPSr
First problem : old kernel module (linux specific)
When having a modern linux distribution, you have some hotplug stuff
that will try to handle every hardware you connect by launching
correct application or loading dedicated kernel module. When you will
plug you garmin unit, chances are it will load garmin_gps
module. This module emulates a serial device as an interface to the
GPSr. This was needed for old tools only aware of serial stuff, but it
is obslete now, as most of them speak USB. First step is to blacklist
this module: simply add it to /etc/hotplug/blacklist.d/garmin file
(create this file). You're done !
Second problem : being root (linux specific)
The second problem is that applications need root privileges to access
the USB device as it is unknown to hotplug stuff. I still don't have
fixed this as I'm used to ask sudo (which is bad for such
applications).
Basic operation
To download a track, you have to give the -t option. Then you
should also give a time span to select only the track you want with
the start and stop options. You should also specify which
output format you want, most probably Google Earth, as it's the only
software I known doing such a good job: -o kml . For example:
gpsbabel -i gpx -f file.gpx -x track,start=2007052206,stop=2007052209 -o kml,units=m -F test.kml
or (if you use gpsbabel command to access the GPSr):
gpsbabel -t -i garmin -f usb: -x track,start=2007052206,stop=2007052209 -o kml,units=m -F test.kml
The generated kml file will include the track along with extra data: the time (so you can replay your flight), but also some speed informations. For example, for each point, I can see my ground speed and my vertical speed.
Complex flight analysis
If you need more complex analysis, you should have a look to the ''moulinette''
. As input, it accepts various format, but some seems more supported
than other. I suggest using igc :
gpsbabel -i gpx -f file.gpx -x track,start=2007052206,stop=2007052209 -o igc -F test.igc
or (if you use gpsbabel command to access the GPSr):
gpsbabel -t -i garmin -f usb: -x track,start=2007052206,stop=2007052209 -o igc -F test.igc
Then you simply have to submit this file to the ''moulinette''
. You will have a kmz that Google Earth can open. It will include
CFD
data (which one of triangle, triangle FAI, ... maximizes the points
earned), max Vz, ...
Following script can be used from command line to automatically submit the file and get the resulting kmz.
#!/bin/bash
CURL=curl
#OUTPUT=output.kmz
PILOT=$USER
DATE=`date +%d/%m/%y`
TIMESHIFT=`date +%z`
#TAKEOFF=undef
#LANDING=undef
#INPUT=input.igc
ANALYSIS=1
CFD=1
# no customization below
URL=http://trace.parawing.net/gps2ge.php
EXTRA=
if [ ! -z $ANALYSIS ]; then
EXTRA+=" -F Analysis=checked "
fi
if [ ! -z $CFD ]; then
EXTRA+=" -F cfd=checked "
fi
$CURL -o $OUTPUT \
-F MAX_FILE_SIZE=1000000 \
-F pilot=$PILOT \
-F date=$DATE \
-F timeshift=$TIMESHIFT \
-F departure="$TAKEOFF" \
-F arrival="$LANDING" \
-F userfile=@$INPUT \
$EXTRA \
-F ' '=checked \
$URL
Here's an example:
INPUT=plomb-st-hil.igc OUTPUT=plom-st-hil.kmz TAKEOFF="Saint Hil Nord" LANDING="Lumbin" ~/bzr/misc-tools/gps2ge-cli/gps2ge.sh
It could be better (using getopt, ...) but hey... ! :)
