User Tools

Site Tools


doc:appunti:hardware:eeepc_navit

This is an old revision of the document!


Installing Navit on the EeePC

Navit is a car navigation system with routing engine. As it is free software, it runs on Linux, it can use the maps from OpenStreetMap, I definitivelly want to give it a try.

Obviously the platform of choice was the new Asus EeePC, where I installed a shining Debian Testing (Lenny).

Compiling and installing Navit with Debian

The package entered Debian Squeeze.

At present (2009-11) you can easily backport it to Debian Lenny, just download the three file .dsc, .orig.tar.gz and .diff.gz from the Debian site and do:

dpkg-source -x navit_0.2.0~svn2663+dfsg.1-1.dsc
cd navit-0.2.0~svn2663+dfsg.1
dpkg-buildpackage -rfakeroot

… obviusly all the build dependencies must be installed before. The results are seven .deb packages that you can install with dpkg -i.

Getting the map from OpenStreetMap

It is possible to load the map of entire Italy. I downloaded italy.osm.bz2 from download.geofabrik.de; converting the file into Navit format I got a 4.7 Mb file:

bzcat italy.osm.bz2 | osm2navit /usr/local/share/navit/maps/italy.bin

I had to tell Navit to load this map editing the file /usr/local/share/navit/navit.xml, adding a mapset section:

<mapset enabled="yes">
    <map type="binfile" enabled="yes" data="/usr/local/share/navit/maps/italy.bin" />
</mapset>

Installing the GPS daemon

This was tested on Debian Squeeze 6.0.

Before starting Navit the gpsd should be up and running. Install the gpsd package and configure it, this is the relevant part of /etc/default/gpsd file:

START_DAEMON="true"
DAEMON_OPTS=""
DEVICES="/dev/gps0"
USBAUTO="true"

This will start gpsd at bootstrap, it will wait for the GPS to be connected to the USB port. Note: when the USB is connected, udev will not start gpsd if it is not already running (i.e. when START_DAEMON=“false”).

udev will handle the automatic connection of the GPS via USB, there is a script /lib/udev/rules.d/60-gpsd.rules in Debian Squeeze which includes the i-Blue 747 USB GPS logger.

For previous Debian releases just add the following line to the file /etc/udev/rules.d/z60_gpsd.rules and restart udev:

# i-Blue 747 USB GPS datalogger
SYSFS{idVendor}=="10c4", SYSFS{idProduct}=="ea60", SYMLINK="gps%n", RUN+="/lib/udev/gpsd.hotplug.wrapper"

When the GPS is plugged into the USB port, udev creates the /dev/gps0 device, when the GPS is unplugged the Unix device is removed and the daemon remains running.

A simple test to check that gpsd is working, is to run gpspipe -r (provided by the gpsd-clients package), it should print out the NMEA messages recevied from the GPS:

gpspipe -r
GPSD,R=1
$GPGGA,112813.000,4353.5310,N,01106.1005,E,0,3,,102.4,M,47.6,M,,*4E
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPGSV,2,1,08,20,76,331,39,11,64,162,30,23,54,197,31,17,37,288,16*74
$GPGSV,2,2,08,31,25,070,25,32,18,072,27,13,16,209,24,04,05,308,*7E
$GPRMC,112813.000,V,4353.5310,N,01106.1005,E,0.08,349.33,040408,,,N*74
$PMTK001,-1,0*1F
$PMTK001,-1,0*1F
$GPGGA,112814.000,4353.5310,N,01106.0969,E,0,3,,102.4,M,47.6,M,,*4B

Problems to be solved with gpsd

We want to be able to plug/unplug the GPS device in the USB port and gpsd should work seamless, but there are two problems:

  1. Permissions: if gpsd starts with no GPS is connected, it switches to group nobody. When a GPS is connected, udev add the /dev/ttyUSB device as root:dialout and /lib/udev/gpsd.hotplug assigns mode 0660. In this scenario gpsd cannot read the device.
  2. GPS unplug/plug: when a gps client opens a connection with gpsd, it starts receiving data. If GPS device is unplugged and plugged again, the connection does not restart automatically. A workaround is to execute gpspipe -r n1 to force device re-opening.

A workaround at the first problem is to let /etc/init.d/udev create a node for /dev/ttyS0 at boot time, even if no devices are present. Per default gpsd will read the group of this device and switches to that group.

mknod -m 0660 /lib/udev/devices c 4 64
chown root:dialout /lib/udev/devices

For the second problem I hacked /lib/udev/gpsd.hotplug, adding the execution of a script when the device is re-added:

    if action == 'add':
        # Force the group-read & group-write bits on, so gpsd will still be
        # able to use this device after dropping root privileges.
        os.chmod(argument, stat.S_IMODE(os.stat(argument)[stat.ST_MODE])|0660)
        connect.sendall("+%s\r\n" % argument)
        connect.recv(12)
        os.system('/usr/local/bin/gps-reopen')

The script is simple this:

#!/bin/sh
/bin/echo /usr/bin/gpspipe -r -n1 | /usr/bin/at now

Don't ask me why I need running gpspipe it via at, I suspect there is the need of a controlling terminal, etc…

I did not tried it extensively, but I was quite impressed: the EeePC's screen size (800×480) is acceptable, panning and zooming are quick.

Turn-by-turn routing is working: point the map, right-click and Set as destination!

Speech

You can have turn-by-turn speech indications by installing the speech-dispatcher-festival package. It will install the speech daemon plus the festival speech synthesis system. I installed also the Italian voice module. This is the list of Debian Lenny packages:

  • speech-dispatcher-festival
  • festvox-kallpc8k
  • festvox-italp16k
  • festvox-itapc16k

To verify that your text-to-speech system is working, try this:

echo "Ti ho nel cuore ma ti vò nel culo" | iconv -f UTF-8 -t ISO-8859-1 | festival --language italian --tts

To let Navit use text to speech, add the following line in navit.xml config file:

<speech type="cmdline" data="echo '%s' | festival --tts --language italian" />

If Italian is not your default locale, you can start Navit just after setting it:

export LANG=it_IT.UTF-8
navit
doc/appunti/hardware/eeepc_navit.1303464747.txt.gz · Last modified: 2011/04/22 11:32 by niccolo