Navit

From Openmoko

Revision as of 09:52, 9 September 2009 by Janvlug (Talk | contribs)

Jump to: navigation, search

Navit is one of the applications that runs on the Openmoko Phones. For a list of all applications, visit Applications

As described on the Navit home page,

"Navit is a car navigation system with routing engine.

Its modular design is capable of using vector maps of various formats for routing and rendering of the displayed map. It's even possible to use multiple maps at a time.

The GTK+ or SDL user interfaces are designed to work well with touch screen displays. Points of Interest of various formats are displayed on the map.

The current vehicle position is either read from gpsd or directly from NMEA GPS sensors."

Some people say Navit is also a good choice for pedestrian and bicycle navigation.

Navit-r2241

Contents

Acknowledgment

Thanks to Alessandro, stefan_schmidt, cp15 and all Navit developers I have done a small ("not really working") preview of Navit on Neo1973 at Telemobility Forum 2007. Thanks to GFoss guys to invite me. Tyrael

Setting up Navit

Install Navit

FSO (OM2008.x,SHR,...)

You can now simply add a feed from there : http://download.navit-project.org/navit/openmoko/svn/

Essentially, to enable this directory as feed and install or update navit do:

  • Only for the first time:
echo src navit http://download.navit-project.org/navit/openmoko/svn > /etc/opkg/navit-feed.conf
opkg update
  • Always:
opkg install navit

Navit will be auto-updated when you run opkg upgrade later

Navit might not be able to use gpsd at startup:

navit:plugin_load:can't load '/usr/lib/navit/vehicle/
libvehicle_gpsd.so', Error 'libgps.so.16: cannot open shared object  
file: No such file or directory'
navit:vehicle_new:invalid type 'gpsd'

to solve this issue (necessary for SHR):

opkg install libgps17
ln -s /usr/lib/libgps.so.17 /usr/lib/libgps.so.16

Debian

Navit is now in Debian testing and unstable.

Add the following line to /etc/apt/sources.list with e.g. editor vi or nano:

    deb http://ftp.de.debian.org/debian unstable main

Then update with apt-get:

    apt-get update

The up-to-date source package is available through git at git://git.debian.org/git/collab-maint/navit.git (browse).

Set up the maps you want

The Easy Way

Use Navit pre-processed OSM maps. Navigate to the region you want, and click select to select it, select the region you want, then click download.
Download OpenStreetMaps

If you just want the entire planet (as of this writing, ~1.8 GB), it's here.

CloudMade also has up-to-date maps from OpenStreetMap by country (by state in the US).

From the command line

OpenStreetMap - follow directions at http://wiki.navit-project.org/index.php/OpenStreetMaps

  • There are some pre-processed, up-to-date maps that can be grabbed with wget:
wget -O germany.bin http://maps.navit-project.org/api/map/?bbox=5.185546875,46.845703125,15.46875,55.634765625

You can put a shell script into /usr/local/bin/update-maps

 #!/bin/sh
 echo "Update OpenstreetMaps"
 echo "---------------------"
 echo "  download and store OSM maps on /media/card/maps"
 wget -O /media/card/germany.bin http://maps.navit-project.org/api/map/?bbox=5.185546875,46.845703125,15.46875,55.634765625
 echo "update germany.bin finished"

You have to make the script executable with:

 chmod u+x /usr/local/bin/update-maps

Then you can update with this script all your maps on the SD-card if you have internet connection:

 update-maps

wget -O map1.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.2,47.5,-122,47.7
wget -O map2.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.4,47.5,-122.2,47.7
wget -O map3.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.4,47.3,-122.2,47.5
wget -O map4.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.2,47.3,-122,47.5
  • A binary Navit map file needs to be created. The following uses osm2navit, and it's recommended that this command be used on something more powerful than the Neo:
cat *.osm | osm2navit --dedupe-ways mymap.bin

Copy the map to the NEO

To copy the map using scp (replace /directory as is appropriate in the following):

scp mymap.bin root@neo:/directory

If you copy the map germany.bin to the SD card on the Neo use e.g.

scp germany.bin root@neo:/media/card

Once it's somewhere on the NEO, Navit needs to know that it's there.

mkdir ~/.navit
cp /usr/share/navit/navit.xml ~/.navit/navit.xml
vi ~/.navit/navit.xml

In the navit.xml file, put the following into a new <mapset> section (and disable the default <mapset> just above - or else it will not work):

<map type="binfile" enabled="yes" data="/directory" />

For example with a germany.bin on the SD-card you use:

<mapset enabled="yes">
 <map type="binfile" enabled="yes" data="/media/card/germany.bin" />
</mapset>

or if you store all downloaded maps in the directory /media/card/maps then add the following lines to navit.xml.

<mapset enabled="yes">
  <map type="binfile" enabled="yes" data="/media/card/maps/*.bin"/>
</mapset>

Note that the bin-file and the map set both have to be enabled.

Disable unused mapset sections by setting enabled to no, e.g. the pre-installed sample maps at line 370 in navit.xml.

<mapset enabled="no">
   <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/>
</mapset>


  • Run navit
    • Start gllin (for GTA01)
    • Start gpsd ( gpsd /tmp/nmeaNP )
    • Start navit
  • The version of osm2navit with which you build the maps should match the version of navit you have. If in doubt, build the maps on the Openmoko.

Tips and Tricks

Center on Vehicle

Navit supports a "always center on vehicle" option.

To activate this add

follow="3"

to the vehicle tag in navit.xml.

  <vehicle name="Local GPS" profilename="car" enabled="yes" active="1" follow="3" 
          source="gpsd://localhost" gpsd_query="w+xj" color="#0000ff">

The "3" causes to give the gui time to do something between the repaints (drag the map or browse the menu). When its set to "1" navit does nothing more than repainting the map continuously.

Routing

Navit Main Menu
Navit Action Menu

The main menu has 4 submenus

  • Action
  • Settings
  • Tools
  • Route

Normally you would assume the entering a town can be found under the submenu Route, but Town is hidden under submenu Action. Route will provide the description of the route as text and a height profile of your trip. Tools was not working on 08/2009 Version of navit on SHR (see SHR User Manual).

Select Destination

Select Country

When you click in the main menu on Action the Action menu appears with 4 subitems.

  • Bookmarks of previous locations (stored in /home/root/.navit/destinations.txt
  • a globe showing a location as destination,
  • a vehicle that shows the current GPS position of the vehicle. If the freerunner receives no GPS signal the locations of the vehicle is set to 0.0.0N and 0.0.0E.
  • Town is the action to enter a destination.
  • Quit navit is the last action in this submenu.

Select the icon Town.


Select Country

Country Options
Enter Bookmark Details

Before you can search for City you have to select a Country. To do that, click on the icon in the left upper corner of the search field (could look like a white square with blue top-left quadrant).

Just type in the first letter of the country (e.g. "G") and Navit makes suggestions (e.g. Gabon, Germany).

Enter Town

When you have selected the country (e.g. Germany) the flag appears and you can select the town. Then you can save the town as bookmark and enter more details like streets to the selected town.

The search is still a little buggy.

Enter Street

You can enter the street and streetnumber and save it as bookmark when you use the destination often.

Bookmarks

Navigation and planning of routes with Navit can be organized with bookmarks.

  • set a bookmark as current position
  • set a bookmark as destination

Then you can see the suggested route in blue on the map.

The GPS-location (if GPS-signal is available) will be highlighted with a small blue circle:

  • a dot in the blue circle is indicating that your are not moving,
  • an arrowhead is indicating the direction, when you are moving.

Then routing can start and in the map the route is highlighted.

Screenshots in Navit Documentation

The screenshots are made with gpe-scap, that can be installed by:

 opkg install gpe-scap

if not installed already. Navigation through your installed application navit and login via ssh on your Freerunner

 ssh -l root 192.168.0.202

assuming that your Freerunner has the IP 192.168.0.202. Any time you want to make a screenshot just start via your desktop computer

 gpe-scap

and save the screenshot to you freerunner. Download the screenshot to your desktop computer with

 desktop# sftp://root@192.168.0.202

News

A deeper look into configuring Navit can be found in the Navit-Wiki.

Getting the display right

If using SHR the keyboard in country/town/street search mode does not fit on the street, make sure your gui configuration is set to the following line:

<gui type="internal" font_size="350"/>

The example line provided for freerunners hides some important icons. Namely, instead of typing your city name first, you will first have to click the button on the top left, to go into country search mode. Enter your country name, then the city name, in order to enable the search function. This requires your map data to be searchable.

You can start in fullscreen mode with fullscreen="1"

<gui type="internal" font_size="350" fullscreen="1"/>

If you want to enable "+" and "-" as Zoom-In and Zoom-Out buttons on the bottom of the map enable the button with the following xml-tags:

<osd enabled="yes" type="button" x="-96" y="-96" command="zoom_in()"  src="zoom_in.xpm"/>
<osd enabled="yes" type="button" x="0"   y="-96" command="zoom_out()" src="zoom_out.xpm"/>

Speech

Navit can speak if you install eSpeak + speech-dispatcher and updates your navit.xml file. For adventurous people, one way to do this (in SHR starting navit did not work anymore after this procedure):

  • mokoTTS aims to integrate these packages in OM:

http://projects.openmoko.org/projects/mokotts/

install espeak, dotconf, and then speech-dispatcher. note: running 2008.8 updating from zecke's "testing" repo does not require "dotconf"

  • change the speech tag in navit.xml:

<speech type="cmdline" data="spd-say '%s'" />

or "spd-say -l fr '%s'" for using the French voice for example.

Note: Package speech-dispatcher broke my audio after suspend with current SHR (2009-04-13, though the problem's not shr, but speech-dispatcher itself). A solution is to disable starting of speech-dispatcher with:

update-rc.d -f speech-dispatcher remove

And then edit /usr/bin/navit, so that it starts speech-dispatcher before navit, and stops it afterwards. See http://lists.openmoko.org/nabble.html#nabble-td1088795

Alternatively, you can make speech-dispatcher restart on resume, see http://trac.shr-project.org/trac/ticket/494

Script to download OSM maps

Wurp wrote a little python script to download all OSM maps within a lat/long rectangle. Just copy the script to a file called dlOSM.sh, chmod +x it, and run it like dlOSM.sh <minimum latitude> <maximum latitude> <minimum longitude> <maximum longitude>

It takes a long time for large maps. I could optimize it some by having it try to get a big section at once, then if it fails, break it into smaller pieces and recurse. I'm not sure when/if I'll get around to that...

dlOSM.sh:

#!/usr/bin/python

import os
import sys
#import math

def doIt(cmd):
  os.system(cmd)

def getOsms(basename, minLat, maxLat, minLon, maxLon):
  '''basename - base name of map, maps are named {basename}{count}.osm
  minLat - latitude of the west side of the map
  maxLat - latitude of the east side of the map
  minLon - longitude of the north side of the map
  maxLon - longitude of the south side of the map'''

  wgetCmdTemplate = 'wget -O %s%s.osm http://api.openstreetmap.org/api/0.6/map?bbox=%s,%s,%s,%s'

  currLat = minLat
  mapCount = 0
  while currLat < maxLat:
    nextLat = min(currLat + 0.1, maxLat)

    currLon = minLon
    while currLon < maxLon:
      nextLon = min(currLon + 0.1, maxLon)

      doIt(wgetCmdTemplate % (basename, mapCount, currLon, currLat, nextLon, nextLat))

      currLon = nextLon
      mapCount = mapCount + 1

    currLat = nextLat

(minLat, maxLat, minLon, maxLon) = map(float, sys.argv[1:])
getOsms('map', minLat, maxLat, minLon, maxLon)


Screenshot-3.png Navit

Navit is a car navigation system with routing engine.


Homepage: http://navit.sourceforge.net
Package:
Tested on:

Personal tools

Navit is one of the applications that runs on the Openmoko Phones. For a list of all applications, visit Applications

As described on the Navit home page,

"Navit is a car navigation system with routing engine.

Its modular design is capable of using vector maps of various formats for routing and rendering of the displayed map. It's even possible to use multiple maps at a time.

The GTK+ or SDL user interfaces are designed to work well with touch screen displays. Points of Interest of various formats are displayed on the map.

The current vehicle position is either read from gpsd or directly from NMEA GPS sensors."

Some people say Navit is also a good choice for pedestrian and bicycle navigation.

Navit-r2241

Acknowledgment

Thanks to Alessandro, stefan_schmidt, cp15 and all Navit developers I have done a small ("not really working") preview of Navit on Neo1973 at Telemobility Forum 2007. Thanks to GFoss guys to invite me. Tyrael

Setting up Navit

Install Navit

FSO (OM2008.x,SHR,...)

You can now simply add a feed from there : http://download.navit-project.org/navit/openmoko/svn/

Essentially, to enable this directory as feed and install or update navit do:

  • Only for the first time:
echo src navit http://download.navit-project.org/navit/openmoko/svn > /etc/opkg/navit-feed.conf
opkg update
  • Always:
opkg install navit

Navit will be auto-updated when you run opkg upgrade later

Navit might not be able to use gpsd at startup:

navit:plugin_load:can't load '/usr/lib/navit/vehicle/
libvehicle_gpsd.so', Error 'libgps.so.16: cannot open shared object  
file: No such file or directory'
navit:vehicle_new:invalid type 'gpsd'

to solve this issue (necessary for SHR):

opkg install libgps17
ln -s /usr/lib/libgps.so.17 /usr/lib/libgps.so.16

Debian

Navit is now in Debian testing and unstable.

Add the following line to /etc/apt/sources.list with e.g. editor vi or nano:

    deb http://ftp.de.debian.org/debian unstable main

Then update with apt-get:

    apt-get update

The up-to-date source package is available through git at git://git.debian.org/git/collab-maint/navit.git (browse).

Set up the maps you want

The Easy Way

Use Navit pre-processed OSM maps. Navigate to the region you want, and click select to select it, select the region you want, then click download.
Download OpenStreetMaps

If you just want the entire planet (as of this writing, ~1.8 GB), it's here.

CloudMade also has up-to-date maps from OpenStreetMap by country (by state in the US).

From the command line

OpenStreetMap - follow directions at http://wiki.navit-project.org/index.php/OpenStreetMaps

  • There are some pre-processed, up-to-date maps that can be grabbed with wget:
wget -O germany.bin http://maps.navit-project.org/api/map/?bbox=5.185546875,46.845703125,15.46875,55.634765625

You can put a shell script into /usr/local/bin/update-maps

 #!/bin/sh
 echo "Update OpenstreetMaps"
 echo "---------------------"
 echo "  download and store OSM maps on /media/card/maps"
 wget -O /media/card/germany.bin http://maps.navit-project.org/api/map/?bbox=5.185546875,46.845703125,15.46875,55.634765625
 echo "update germany.bin finished"

You have to make the script executable with:

 chmod u+x /usr/local/bin/update-maps

Then you can update with this script all your maps on the SD-card if you have internet connection:

 update-maps

wget -O map1.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.2,47.5,-122,47.7
wget -O map2.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.4,47.5,-122.2,47.7
wget -O map3.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.4,47.3,-122.2,47.5
wget -O map4.osm http://www.openstreetmap.org/api/0.5/map?bbox=-122.2,47.3,-122,47.5
  • A binary Navit map file needs to be created. The following uses osm2navit, and it's recommended that this command be used on something more powerful than the Neo:
cat *.osm | osm2navit --dedupe-ways mymap.bin

Copy the map to the NEO

To copy the map using scp (replace /directory as is appropriate in the following):

scp mymap.bin root@neo:/directory

If you copy the map germany.bin to the SD card on the Neo use e.g.

scp germany.bin root@neo:/media/card

Once it's somewhere on the NEO, Navit needs to know that it's there.

mkdir ~/.navit
cp /usr/share/navit/navit.xml ~/.navit/navit.xml
vi ~/.navit/navit.xml

In the navit.xml file, put the following into a new <mapset> section (and disable the default <mapset> just above - or else it will not work):

<map type="binfile" enabled="yes" data="/directory" />

For example with a germany.bin on the SD-card you use:

<mapset enabled="yes">
 <map type="binfile" enabled="yes" data="/media/card/germany.bin" />
</mapset>

or if you store all downloaded maps in the directory /media/card/maps then add the following lines to navit.xml.

<mapset enabled="yes">
  <map type="binfile" enabled="yes" data="/media/card/maps/*.bin"/>
</mapset>

Note that the bin-file and the map set both have to be enabled.

Disable unused mapset sections by setting enabled to no, e.g. the pre-installed sample maps at line 370 in navit.xml.

<mapset enabled="no">
   <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/>
</mapset>


  • Run navit
    • Start gllin (for GTA01)
    • Start gpsd ( gpsd /tmp/nmeaNP )
    • Start navit
  • The version of osm2navit with which you build the maps should match the version of navit you have. If in doubt, build the maps on the Openmoko.

Tips and Tricks

Center on Vehicle

Navit supports a "always center on vehicle" option.

To activate this add

follow="3"

to the vehicle tag in navit.xml.

  <vehicle name="Local GPS" profilename="car" enabled="yes" active="1" follow="3" 
          source="gpsd://localhost" gpsd_query="w+xj" color="#0000ff">

The "3" causes to give the gui time to do something between the repaints (drag the map or browse the menu). When its set to "1" navit does nothing more than repainting the map continuously.

Routing

Navit Main Menu
Navit Action Menu

The main menu has 4 submenus

  • Action
  • Settings
  • Tools
  • Route

Normally you would assume the entering a town can be found under the submenu Route, but Town is hidden under submenu Action. Route will provide the description of the route as text and a height profile of your trip. Tools was not working on 08/2009 Version of navit on SHR (see SHR User Manual).

Select Destination

Select Country

When you click in the main menu on Action the Action menu appears with 4 subitems.

  • Bookmarks of previous locations (stored in /home/root/.navit/destinations.txt
  • a globe showing a location as destination,
  • a vehicle that shows the current GPS position of the vehicle. If the freerunner receives no GPS signal the locations of the vehicle is set to 0.0.0N and 0.0.0E.
  • Town is the action to enter a destination.
  • Quit navit is the last action in this submenu.

Select the icon Town.


Select Country

Country Options
Enter Bookmark Details

Before you can search for City you have to select a Country. To do that, click on the icon in the left upper corner of the search field (could look like a white square with blue top-left quadrant).

Just type in the first letter of the country (e.g. "G") and Navit makes suggestions (e.g. Gabon, Germany).

Enter Town

When you have selected the country (e.g. Germany) the flag appears and you can select the town. Then you can save the town as bookmark and enter more details like streets to the selected town.

The search is still a little buggy.

Enter Street

You can enter the street and streetnumber and save it as bookmark when you use the destination often.

Bookmarks

Navigation and planning of routes with Navit can be organized with bookmarks.

  • set a bookmark as current position
  • set a bookmark as destination

Then you can see the suggested route in blue on the map.

The GPS-location (if GPS-signal is available) will be highlighted with a small blue circle:

  • a dot in the blue circle is indicating that your are not moving,
  • an arrowhead is indicating the direction, when you are moving.

Then routing can start and in the map the route is highlighted.

Screenshots in Navit Documentation

The screenshots are made with gpe-scap, that can be installed by:

 opkg install gpe-scap

if not installed already. Navigation through your installed application navit and login via ssh on your Freerunner

 ssh -l root 192.168.0.202

assuming that your Freerunner has the IP 192.168.0.202. Any time you want to make a screenshot just start via your desktop computer

 gpe-scap

and save the screenshot to you freerunner. Download the screenshot to your desktop computer with

 desktop# sftp://root@192.168.0.202

News

A deeper look into configuring Navit can be found in the Navit-Wiki.

Getting the display right

If using SHR the keyboard in country/town/street search mode does not fit on the street, make sure your gui configuration is set to the following line:

<gui type="internal" font_size="350"/>

The example line provided for freerunners hides some important icons. Namely, instead of typing your city name first, you will first have to click the button on the top left, to go into country search mode. Enter your country name, then the city name, in order to enable the search function. This requires your map data to be searchable.

You can start in fullscreen mode with fullscreen="1"

<gui type="internal" font_size="350" fullscreen="1"/>

If you want to enable "+" and "-" as Zoom-In and Zoom-Out buttons on the bottom of the map enable the button with the following xml-tags:

<osd enabled="yes" type="button" x="-96" y="-96" command="zoom_in()"  src="zoom_in.xpm"/>
<osd enabled="yes" type="button" x="0"   y="-96" command="zoom_out()" src="zoom_out.xpm"/>

Speech

Navit can speak if you install eSpeak + speech-dispatcher and updates your navit.xml file. For adventurous people, one way to do this (in SHR starting navit did not work anymore after this procedure):

  • mokoTTS aims to integrate these packages in OM:

http://projects.openmoko.org/projects/mokotts/

install espeak, dotconf, and then speech-dispatcher. note: running 2008.8 updating from zecke's "testing" repo does not require "dotconf"

  • change the speech tag in navit.xml:

<speech type="cmdline" data="spd-say '%s'" />

or "spd-say -l fr '%s'" for using the French voice for example.

Note: Package speech-dispatcher broke my audio after suspend with current SHR (2009-04-13, though the problem's not shr, but speech-dispatcher itself). A solution is to disable starting of speech-dispatcher with:

update-rc.d -f speech-dispatcher remove

And then edit /usr/bin/navit, so that it starts speech-dispatcher before navit, and stops it afterwards. See http://lists.openmoko.org/nabble.html#nabble-td1088795

Alternatively, you can make speech-dispatcher restart on resume, see http://trac.shr-project.org/trac/ticket/494

Script to download OSM maps

Wurp wrote a little python script to download all OSM maps within a lat/long rectangle. Just copy the script to a file called dlOSM.sh, chmod +x it, and run it like dlOSM.sh <minimum latitude> <maximum latitude> <minimum longitude> <maximum longitude>

It takes a long time for large maps. I could optimize it some by having it try to get a big section at once, then if it fails, break it into smaller pieces and recurse. I'm not sure when/if I'll get around to that...

dlOSM.sh:

#!/usr/bin/python

import os
import sys
#import math

def doIt(cmd):
  os.system(cmd)

def getOsms(basename, minLat, maxLat, minLon, maxLon):
  '''basename - base name of map, maps are named {basename}{count}.osm
  minLat - latitude of the west side of the map
  maxLat - latitude of the east side of the map
  minLon - longitude of the north side of the map
  maxLon - longitude of the south side of the map'''

  wgetCmdTemplate = 'wget -O %s%s.osm http://api.openstreetmap.org/api/0.6/map?bbox=%s,%s,%s,%s'

  currLat = minLat
  mapCount = 0
  while currLat < maxLat:
    nextLat = min(currLat + 0.1, maxLat)

    currLon = minLon
    while currLon < maxLon:
      nextLon = min(currLon + 0.1, maxLon)

      doIt(wgetCmdTemplate % (basename, mapCount, currLon, currLat, nextLon, nextLat))

      currLon = nextLon
      mapCount = mapCount + 1

    currLat = nextLat

(minLat, maxLat, minLon, maxLon) = map(float, sys.argv[1:])
getOsms('map', minLat, maxLat, minLon, maxLon)


Screenshot-3.png Navit

Navit is a car navigation system with routing engine.


Homepage: http://navit.sourceforge.net
Package:
Tested on: