Monday, December 1, 2014

How to Build a GPS Navigation PC in Linux

For this project, I used my old Acer Aspire One D257 netbook PC and a
GlobalSat BU-353-S4 USB GPS receiver (or see the GlobalSat web site)

The total cost was only about $35, just the cost of the GPS receiver.

Brief Overview

  1. Install a Linux operating system.
  2. Install gpsd, xgps, and Navit.
  3. Copy /etc/navit.xml to ~/.navit/navit.xml
  4. Download a map from openstreetmap. Copy to ~/.navit/maps/yourmap.bin
  5. Edit ~/.navit/navit.xml 

Software Installation Details

Operating System
For the operating system, I installed the 64 bit version of Lubuntu by writing the .iso image onto a 2GB micro SD card using the USB image writer program that came with Linux Mint 17. Then I inserted the card into a USB card reader and booted the netbook PC from the USB port.

After I installed the Lubuntu version of Linux, I had to play around with the settings in the Lubuntu Software Center so that it would update the available package list. Even then, searches were still agonizingly slow.

GPS Software
Once the software center started working, I installed Navit navigation software.

Then I installed gpsd. It makes it easy to get the GPS receiver working. And it works well with Navit.

I also installed xgps to test the GPS receiver. If you type xgps in a terminal, it will give you the link to install it if you don't already have it.

To test the GPS receiver, the instructions that came with it said to use the following commands:

su root
 
stty -F /dev/ttyUSB0 ispeed 4800 && cat < /dev/ttyUSB0

This didn't work out so well, or at all. It works if you split up the second command into two parts. Then you get to see gibberish. That's not a verification test in my opinion.

Here's how you test to see if the USB GPS receiver is working.

1. Install gpsd. If you don't already have it, type gpsd in a terminal, and it will tell you the command to install it. Then you can highlight it and middle-click it onto the command line.

2. Plug in the USB GPS receiver.

3. Run gpsd. But you need to specify where your GPS device is. If you just try the command gpsd without any command line arguments, you'll get this error:

gpsd:ERROR: can't run with neither control socket nor devices

So I used the following command to tell gpsd to look at USB port 0:

gpsd /dev/ttyUSB0

4. Run xgps. Once the red LED starts flashing on the BU-353-S4, it's locked onto your GPS location. You should see a list of satellites and a picture of the sky view. (I had to re-boot my desktop PC after installing the software before xgps showed satellites.) Since I don't want to publicly share my GPS location, here's a screenshot of the program without any satellite data, before I re-booted my computer:


Setup Navit

Download a map from the navit planet extractor. It uses maps from openstreetmap.org
Zoom in on the map area you want to download, then under map controls, click select. Then click on Get map! It will download the file to your Downloads folder.

Create a folder called maps in ~/.navit/
(The folder will be created after you run Navit for the first time.)
Rename your map file to something like UT.bin
Move your map file to ~/.navit/maps/

Edit navit.xml
Copy /etc/navit/navit.xml to ~/.navit/navit.xml
You can use this command:

cp /etc/navit/navit.xml ~/.navit/

Use gedit to edit ~/.navit/navit.xml

Search for openstreetmaps and it will find this section:

<!-- If you dont want to use the sample map, either set enabled="no" in the next line or remove the xml file from the maps directory -->
        <mapset enabled="yes">
            <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/>
        </mapset>

        <!-- Mapset template for openstreetmaps -->
        <mapset enabled="no">
            <map type="binfile" enabled="yes" data="/media/mmc2/MapsNavit/osm_europe.bin"/>
        </mapset>


Change it to this (changed text is in bold).

<!-- If you dont want to use the sample map, either set enabled="no" in the next line or remove the xml file from the maps directory -->
        <mapset enabled="
no">
            <xi:include href="$NAVIT_SHAREDIR/maps/*.xml"/>
        </mapset>

        <!-- Mapset template for openstreetmaps -->
        <mapset enabled="
yes">
            <map type="binfile" enabled="yes" data="
~/.navit/maps/UT.bin"/>
        </mapset>


Save your changes to navit.xml.

Run Navit
You should be ready to run Navit now. If you have your GPS unit plugged in and xgps shows satellites and your location, Navit should start with your map loaded and your GPS location circled.

Click on the map and it will disappear and show you a menu.
To navigate, click on actions, then click on town.
Type in the town you want to navigate to. Click on the suggestion.
Then click on Streets. Type in the street name. Click on the suggestion.
Then click on House numbers and type in the house number. This step never works for me. So hit escape or click the green check mark to go back.

You can add it as a bookmark or set it as a destination. Adding it as a bookmark is good if you don't want to enter it every time. Since the house numbers feature isn't working for me, after I click "set as destination", it plots the route on the map, but ends up at the wrong place on the right street.

I haven't yet actually used it to navigate, so I'll probably update this post soon.

10 comments:

  1. Provident Engineering: So I got a surf architecture from the chip set in this GPS receiver which is first generation,Because im a linux user I installed the gpsd daemon socket connector for the receiver, Im customizing my own GPS navigation software through the great and almighty program called NAVIT,Everything is pretty and dandy!! Working great but im getting very irritated because of one thing,I cannot figure out the difference between this folder or directory ~/.navit and this I know is just a folder /navit So what the hell is this ~/.navit?? and where can I find it or create it??? Followed directions to the navit.xml from this link I did everything even edited the xml to destination folder with downloaded maps from ''openstreetmaps'' atleast I think Im missing the copy paste or create part need help thanks anyone!! ehttp://www.providentengineering.blogspot.com/2014/12/how-to-build-gps-navigation-pc-in-linux.html

    ReplyDelete
  2. Hi Ryan,
    I understand your frustration. The tilde ~ symbol is a shortcut to your home directory. So after you run Navit for the first time, it will create a folder, .navit in your home directory. Since any file or folder that starts with a dot is hidden, you won't see it unless you specifically ask to see hidden files.

    ReplyDelete
  3. Oh well thanks man! That makes alot more since to me now because I was not sure about that specific hidden folder now I just add the map bin file to that folder along with the xml file and then edit the xml.

    ReplyDelete
  4. here is the command to find hidden folders find $HOME -name ".navit"

    ReplyDelete
  5. If anyone else is not new to the whole copy thing in the terminal I will consider you choose to use ''Thunar'' sudo apt-get install thunar This will make finding the hidden files easier.

    ReplyDelete
  6. Working great thanks!! Just another helpful solution for new people who are doing this make sure to use this destination ~/.navit/maps/UT.bin Capitol letters and lowercase letters are very important so make sure to get these right hope everyone enjoys!!

    ReplyDelete
  7. GPS usefulness can be utilized by crisis administrations and area based administrations to find cellular telephones. Helped GPS is a GPS innovation frequently utilized by the cellular telephone since it decreases the force necessities of the cell telephone and expands the precision of the area got. https://biobigdata.ucsd.edu/members/1939/blog/2016/09/garmin-camper-660lmt-the-latest-navigator-you-need-to-have

    ReplyDelete
  8. Great post… Thanks for sharing it. This is interesting post GPS navigation. I have something to share with you. Check here: indoor positioning system

    ReplyDelete
  9. Free Download Gps Navigation Software For Windows 7 Laptop

    GPS Navigation App for Android

    ReplyDelete