GPS

47°04' N 8°20' E is where I live most of the time, if I'm not there then I will probably at 46.150108 N 8.926396E

GPS devices

Probably all GPS receiver support the NMEA protocol (National Marine Electronics Association). This protocol dumps pure and readable ASCII characters to a serial link. Traditionally this was a RS232 connection with low speed. Such receivers (and more complex GPS devices supporting this mode) can just be connected to a RS232 port and be read via a /dev/ttyfile.

If the PC has no or no more free RS232 port see USB serial how to connect a RS232 serial device to a USB laptop.

NAVILOCK GPS USB device

This receiver contains a serial to USB converter chip inside plus a GPS receiver. When plugged in lsusb shows it is a Prolific chip. Build a kernel and select under device drivers > usb support > usb serial converter support for the chip. Having the kernel with the device driver, the Navilock gps receiver will be accessible via /dev/ttyUSB0. For a quick test type cat /dev/ttyUSB0 and you see some characters arriving in the console. Since the baud rate probably does not match, the output will not be readable. However this works probably just when working as root. Checking the file /dev/ttyUSB0shows that it belongs to the uucp group where your regular user account is probably no member. Therefore include in your user account also the uucp group.

Figure 13.3. Navilock

navilock


Finally to see the nice NMEA strings, start gtkterm and set the baud rate of 38400.

$GPRMC,111400.000,A,4704.9311,N,00820.5919,E,0.0,223.5,260610,\

,,A*6D $GPGGA,111400.000,4704.9311,N,00820.5919,E,1,05,2.0,444.5,M,\45.0,M,,0000*5D $GPVTG,223.5,T,,M,0.0,N,0.0,K,A*0B $GPGLL,4704.9311,N,00820.5919,E,111400.00,A,A*6F $GPGSA,A,2,05,09,10,26,27,,,,,,,,2.2,2.0,0.9*34

The navilock device identifies itself to the system as USB to RS232 converter. This has the advantage that it is easy to make it work. The disadvantage is that your computer might become confused when you plug in an other USB to RS232 converter or when you unplug and replug. To get rid of loosing your gps connection due to such effects a udev rule is desired. Unfortunately setting up a udev rule for navilock is not easy since it reports no serial number. To see what it reports type:

udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)

A difference that I see between my USB to RS232 cable and navilock is:

ATTRS{bcdDevice}=="0400"

Therefore a udev rule can be set in /etc/udev/rules.d/10-local.rules:

        SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \
ATTRS{bcdDevice}=="0400", NAME="gps%n"

But then gtktem might refuse to open since it does not recognize /dev/gps0as a tty device. If an other tty device is available then gtkterm opens and /dev/gps0can be entered and then it works.

A better rule to not have this effect is to make a symlink instead of replacing the device name:

        SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", 
ATTRS{bcdDevice}=="0400", SYMLINK+="gps%n"

Or even better, when plug in navilock create the symlink and start gpsd the gps daemon:

        SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", 
ATTRS{bcdDevice}=="0400", SYMLINK+="gps%n", 
RUN+="/usr/sbin/gpsd /dev/gps%n"

HAiCOM PCMCIA GPS receiver

For the HAiCOM CF or PCMCIA GPS receiver HI-302CF create a kernel with char devices serial devices 8250 PCMCIA support. Then e.g ttyS1 will be your 4800 NMEA port.

The gps daemon gpsd

GPS applications might access the GPS receiver directly. This might be the quickest way to have them running, but has also some drawbacks:

  1. Every application has to setup the hardware and tackle the hardware issues

  2. Just one application can get the GPS data. No simultaneously use of the gps data is possible.

  3. Applications have to be written for different kind of hardware

The gpsd can be put between GPS receiver and applications to solve these issues.

The gps daemon gpsd is available from http://www.catb.org/gpsd/and communicates through a TCP/IP port.

The simplest way is to start it as:

gpsd /dev/ttyUSB0

To see more info it can be run in foreground and show more debug info:

gpsd -N -D 2 /dev/ttyUSB0

Small applications come with it see man gps:

xgps to get the satellite views and coordination.

xgpsspeed --speedunits kmh to get a speedometer

cgps for a text console.

The maps

GPS without having maps is not that funny, but maps are often not free. Here some links to get maps:

http://www.openstreetmap.org/ nice maps not very detailed

http://www.acme.com/mapper/ very nice maps, detailed, optional satellite view

Gpsbabel

Gpsbabel supports many gps devices and formats to exchange data such as waypoints, tracks, routes. See: http://www.gpsbabel.org/. Unfortunately there are still some binary format as the ones from the older versions of http://www.swisstopo.admin.ch/that are not openly documented and therefor not supported. Gpsbabel supports gpx (the GPS Exchange Format) that is pure XML, see: http://www.topografix.com/gpx.asp. Since the gps manufacturers could not agree on a common data format gpx has become a standard that is widely supported. As example you can open gpx in google earth.

Figure 13.4. Griess glacier

griess glaicer


Inside gpx files there can be different and multiple things, as a single track or all your tracks, different way points or routes. Since gpx is xml it can easily be edited using a xml editor. As example all except the desired track can be deleted and then imported to google earth to get a picture as above. Unfortunately gps gets sometimes in trouble not finding enough and good gps signals especially in steep mountain area facing south (from Switzerland's point of view).

gpsbabel is a command-line tool. It has no man page but a -h option. However -h brings so much text that does not fit into the terminal window and its buffer, so gpsbabel -h > gpsbabel.txt. gpsbabel is usually called as:

gpsbabel -i<input format> -f <input file or device> -o <output format> -F <output file or device>

Obviously it is wise to use gpx as format for the files stored on the computer.

Additional options that might be used are -t for tracks, -r for routes and -w for waypoints. To get all the waypoints (-w is not necessary since it is the default):

gpsbabel -i garmin -f /dev/ttyUSB0 -o gpx -F mywaypoints.gpx

To get all the routes

gpsbabel -r -i garmin -f /dev/ttyUSB0 -o gpx -F myroutes.gpx

To get all the tracks (this can take quite a while)

gpsbabel -t -i garmin -f /dev/ttyUSB0 -o gpx -F mytracks.gpx

A Gui front end for gpsbabel type gpsbabelfe to get the gui that comes with gpsbabel.

Using the gui the command line parameters must not be identified. This way nmea gps data can easily converted to gpx.

To convert unknown ascii based gps data into gpsbabel the universal csv format http://www.gpsbabel.org/htmldoc-development/fmt_unicsv.html suits well. The data has to be formatted as table using standard spreadsheet tools as OpenOffice Calc. The spreadsheet has to be exported to the basic and well supported csv format. Cvs is very simple but not so well specified. Different separator characters are possible, unicvs supports the tab and the, characters and detects them automatically. Further the cvs needs to be formatted using the first row as header. Unfortunately tools as OpenOffice Calc want to be too smart (the result of that is that they don't do what you want) and might round the longitude latitude data to something as two decimal places and add text delimiter characters as " to the header line and time cells. Gpsbabel seems to be tolerant for some stupidities as the delimiter characters, but it can obviously not add more decimal places. Therefore open the csv file with a regular text editor to discover the stupid things that OpenOffice Calc has done. To import a useful track, you should observe a line as:

      "Latitude","Longitude","Altitude","Date","Time"
46.152664,8.918796,169.33,2006-06-04,"10:00:37"

The date column is wise to add to not have it to default to some historical computer date. Once imported using gpsbabelfe or the command line the gpx data its ready to be used and looks as:

      <gpx version="1.0" creator="GPSBabel - http://www.gpsbabel.org" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
  <time>2011-08-29T08:09:55Z</time>
  <bounds minlat="46.151764000" minlon="8.856053000" maxlat="46.173500000" maxlon="8.918796000"/>
  <trk>
    <trkseg>
      <trkpt lat="46.152664000" lon="8.918796000">
        <ele>169.330000</ele>
        <time>2006-06-04T08:00:37Z</time>
      </trkpt>
    </trkseg>
  </trk>
</gpx>

Navit

Navit is a navigation and routing software. It is in the sunrise overlay (and akoya) portage overlay (found by eix navit). The home page is http://www.navit-project.org/. There is also a wiki: http://wiki.navit-project.org/index.php/Main_Page

A Live CD with navit that runs also from usb is available at http://wiki.mandrivauser.de/doku.php?id=allgemein:editionen:navigation

The program is still in a early stage but works well. Gentoo makes use use of an ebuild with a 9999 number and fetches the sources directly from cvs ( emerge navit) therefore no released version will be emerged and the manifest file does not have a DIST entry with the checksum to be verified when the source code is received. However on the navit site there are released versions available.The useflags to be consider are gps and speechd. It can make use of speech output using speechd.

Configuration

After emerging do cp /usr/share/navit/navit.xml ~/.navit to get the necessary config file. The defaults are ok when using gpsd. The navit.xml file is a regular xml file that can be edited with any text editor or with a xml editor. To switch between different options and enable/disable features the xml tags used have often the attribute enabled that can be set to yes or no. This is easier than to comment and uncomment sections.

There are two GUI's available: The Gtk and the Internal. The Internal Gui aims more a navigation device with 3D views and simple big user interface. The Gtk is more as a regular PC application. Obviously the settings for the desired map of your neighborhood has to be made. Check that the xml attribute enabled is set to yes for the preferred gui.

Figure 13.5. Navit gtk

Navit


Figure 13.6. Navit Internal gui

Navit gui


Figure 13.7. Navit menu

Navit menu


The easiest way to get a map is going to http://maps.navit-project.organd grab the map out of a world map, it makes use of http://www.openstreetmap.org/ a converted binary file is fetched ready to be used by navit.

Add it to navit.xml as

        <map type="binfile" enabled="yes" data="<path and name of the file>" />   

Different icons can be made visible on the screen enabling the osd settings:

            <osd enabled="yes" type="navigation_next_turn" x="0" y="-5" />
         

With osd take care that buttons are not at the same place as labels, otherwise buttons might not work.

If you navigate then navit defaults to the country set by the LANG environmental variables. This results the you always have to enter your country before you can select a town. to avoid this start navit as

LANG="de_ch.UTF-8" navit

When happy probably do a bash script and a desktop launcher for that.

To have 3D at startup add a pitch as

        <navit center="4708 N 834 E" zoom="64" tracking="1" orientation="-1" recent_dest="10" pitch="30">   

To start fullscreen

        <gui type="internal" enabled="yes" fullscreen="1" >      

Day or night layout is changed automatically depending on time. The order of layout tags is used to set the default layout. Don't define a night layout to disable it.

Plan and Route

Make sure under settings > map you have selected route, so you will see the route. Select the destination in action > town or action > bookmark. If nothing happens select a close destination and see if it is a map issue.

Bookmarks

Bookmarks are in ~/.navit/bookmark.txtClick on the destination flag enter an address and click bookmark, the address is added to your bookmarks

gpsdrive

Gpsdrive http://www.gpsdrive.de/ is an universal GPS software with many features that can record and show tracks. It can make use of http://www.openstreetmap.org/ and other maps. The gsp daemon gpsd is used to connect to a gps device. There is a wiki https://sourceforge.net/projects/gpsdrive/

Figure 13.8. Gpsdrive

Lucerne


It is not stable under gentoo and runs really slow on smaller devices. Also many changes happened among their versions and the user interface is not intuitive.


Linurs Servernest startpage