BlueWave Studio forum
Navit install on OAP for iphone users - Printable Version

+- BlueWave Studio forum (https://bluewavestudio.io/community)
+-- Forum: OpenAuto Pro (https://bluewavestudio.io/community/forum-86.html)
+--- Forum: Iphone Users (https://bluewavestudio.io/community/forum-98.html)
+--- Thread: Navit install on OAP for iphone users (/thread-1072.html)



Navit install on OAP for iphone users - tthenrie - 08-30-2019

UPDATED 04/22/20

This is a short help for those who, like me, like OAP, but are iphone users and therefore have no Android Auto functions. I installed Navit for my navigation and it seems to be working well. Here's how I did it.

Firstly, I have a rpi4b running the latest Buster kernel, with the latest OAP beta, 3.3.2 b2. I have also connected the Adafruit Ultimate GPS Breakout board, Adafruit, added a gps antenna, and have it configured and functioning.

after booting, you should do the initial configuration via raspbian's GUI and then update your operating system. You can use either the Raspbian configuration (raspi-config) GUI to do this or go into Terminal and do the following:

sudo apt update
sudo apt upgrade

Let those finish. If you are running an rpi4b, like I am, you may also want to update the firmware, but this is not recommended as a normal update function. Run:

sudo rpi-update

After you have done your initial configuration and rebooted, open raspbian's "Preferences" and select "add/remove software."

Enter "Navit" in the search box. Select all the files indicated below, then click "Apply" and let it install. You can also install manually through github or by following the tutorial on theRaspberry Pi Wiki, at https://wiki.navit-project.org/index.php/Raspberry_Pi, however, doing it by the add/remove function in Preferences, it will automatically be added to the raspbian menu and place the software in logical directories, so you don't have to figure all that out on your own. 

You will need to install the following:
navit-0.5.3+dsfg.1-1
navit-data-0.5.3+dfsg.1-1
navit-graphics-gtk-drawing-area-0.5.3+dfsg.1-1
navit-gui-gtk-0.5.3+dfsg.1-1
navit-gui-internal-0.5.3+dfsg.1-1

These will give you a variety of configuration options once you start configuring Navit.

After installing, you must configure the navit.xml file, located at /etc/navit/navit.xml. According to instructions in that file, you should not modify that file, but should create a copy of it at /home/pi/.navit/navit.xml (notice the "." in front of navit makes that directory a hidden directory). Now you can do your configuration in that file and it will persist through updates and upgrades.

I used a tutorial at Ozzmaker, Navigating... for the configuration settings, as I like the way his gui looks. Ozzmaker provides downloads and links for his configuration files as well as good explanations.

There are several initial settings that must be set before you will get anything out of Navit.

sudo nano /home/pi/.navit/navit.xml

Now look for the line that begins with

<config xmlns:xi=

at the end add language="eng_US" (change this to your country code, such as "eng_AU" etc.)

The line should look like:

<config xmlns:xi="http://www.w3.org/2001/XInclude" language="eng_US">

Now look for the line that starts with:

<navit center="

Use Google Maps on your iphone to get the gps location where you want Navit to set a starting location point. By default it is set somewhere in Denmark, I think. Enter that location between the quotation marks in place of what's there (no comma between the long/lat).

Next, find the line that begins with:

<gui type="

It should read:

<gui type="internal" enabled="yes"><![CDATA[

Now find

<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj">

This is where you tell Navit where to get GPS information for navigation. Unless you have an unusual setup on your gps breakout, it should not be changed. I added "follow="2" " to cause Navit to update position every 2 seconds. This will keep your vehicle centered in the map pretty well, rather than waiting for your vehicle to reach the edge of the map before it updates. For my configuration it reads:

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

If, after you get Navit started and you don't get any gps location, or your map shows blank, the "source" setting is probably where the problem is. Different gps devices may have different settings. Use the tutorial for setting up a GPS Breakout to make sure your unit is actually working before changing this setting in Navit.

Also, to get speed in mph, in the same line where you inserted your gps location as center, add 

imperial="1"

at the end before the >.

It should read:

<navit center="YOUR GPS LOCATION" zoom="256" tracking="1" orientation="-1" recent_dest="250" drag_bitmap="0" imperial="1">

Most of that stuff is on the Ozzmaker tutorial, but you need it even if you don't use all his stuff.

The last critical setting is the map source. I recommend maps from the Navit map extractor. You can download maps from this site directly into your maps directory in the correct format to be used by Navit.

Create a convenient "Maps" directory somewhere convenient, like maybe /home/pi/Maps. Download and unpack your maps package into this directory.

Now find the line in .navit/navit.xml that starts with

<!-- If you have the reiseplaner maps...

That option should be set to "no".  Farther down, also disable the sample mapset. Keep going down to the openstreetmaps option and enable it, by replacing "no" with "yes". Now you have to tell Navit where to find your maps. The setting should look something like this:

<mapset enabled="yes">
                <map type="binfile" enabled="yes" data="/home/pi/Maps/yourmapfile.bin"/>

Make sure the Garmin mapset option is also set to "no" as you can use only one kind of mapset at a time in Navit. That is, unless you are using the Garmin maps. In that case, enable the Garmin maps instead.

You can also download maps directly from Openstreetmaps.org. They can be downloaded in various formats and include a current map of the entire world (a VERY BIG download), but you have to convert those maps to a .bin format to be usable by Navit. There is a wiki on the openstreetmap-navit wiki for this, but I haven't been able to get it to work. Don't know why. I have been successful in downloading and unpacking smaller sections of North America and converting the osm files to .bin. Still working on the .pbf conversion thing. However, the easiest is using the Navit map extractor site.

Navit has innumerable variables for setup. You can customize everything from the display to settings for your particular vehicle, bicycle, or even a horse! Do all your configuration options in this file. Save a backup of it somewhere not on your rpi SD card, so you can restore it if necessary, in case you have to re-flash your operating system.

Your Navit installation should now be working. Go back over the Ozzmaker tutorial and set anything else you find interesting from his tutorial. You can download and install his configuration files by following his instructions. For his navit.xml configuration, open his file and cut/paste it into your .navit/navit.xml file. It should work right off the bat, although you still need to configure the lines listed above according to your setup needs. If you start getting error messages when you try to run Navit, go back and do the cut/paste operation again and try again.

You can add Navit to your OAP Applications menu by creating a Navit logo image file by using an image editor, such as Preview on your mac or iphone. Make it small and save it as a .png file. Now edit your openauto_applications.ini (located at /home/pi/.openauto/config/openauto_applications.ini) file and add the following to the bottom of it:

[Application_4]
Name=Navit
Path=<path to your Navit exec file>  (This path is /usr/bin/navit on my installation)
IconPath=/home/pi/.openauto/icons/navit_48_48.png (you can find appropriate navit icons in /usr/bin/navit/icons)
Arguments=
Autostart=false

Make sure the Path points to your Navit exec file. If you followed this tutorial, it should be /usr/bin/navit. 

It is important to have the

[Applications]
Count=5

at the beginning of the file set correctly. If you have 6 applications the number will be 6. The [Application_#] for the application you are adding should be the next number in line, which is 4 in my case, since the first application is 0.  Make sure you store your navit icon in the icons folder indicated above. 

You can find a good Navit icon at /user/bin/navit/icons/navit_48_48.png after downloading Ozzmaker's icons file.

NOTE: Currently OAP limits the number of applications to a max of 8 applications. You can add other executable applications in this same manner and delete ones you don't use, but max is still 8.

Hope that works for you. Since I've installed the new OAP beta, I've had to reinstall Navit from scratch. I should have thought to save the navit.xml file and reinstalled it after the upgrade. Oh well. It helped this tutorial.

TTH


RE: Navit install on OAP for iphone users - botswanabub - 10-16-2019

funny ... I did the same and now I found your post.
but finaly I have one problem: if I'm closing NAVIT and restart it, the /dev/ttyUSB connection is broken ... at moment I'm not sure why.
Do you have the same problem, or is it something with my config?


RE: Navit install on OAP for iphone users - tthenrie - 10-31-2019

(10-16-2019, 12:53 PM)botswanabub Wrote: funny ... I did the same and now I found your post.
but finaly I have one problem: if I'm closing NAVIT and restart it, the /dev/ttyUSB connection is broken ... at moment I'm not sure why.
Do you have the same problem, or is it something with my config?
I haven't had that problem. I suspect you need to set your gpsd configuration in /etc/default/gpsd. Set to DEVICES="/dev/ttyUSB0". If that isn't the problem, then I suspect your gpsd daemon isn't starting automatically. Try 

sudo killall gpsd

sudo systemctl enable gpsd.socket
sudo systemctl start gpsd.socket

and see if that doesn't fix it.


It is also possible your device address isn't ttyUSB0, like mine is. It could be ttyAMA0 or something else. Try 

cat /dev/ttyUSB0 and see if you get live data from your device. If not, try another address to see if anything gives live data.

TH



RE: Navit install on OAP for iphone users - botswanabub - 11-01-2019

hi, finally I figured out the problem. I did not connect the GPSD, instead I used the hardware conncetion /dev/ttyUSB ... it seems that navit is not closing the connection when you shutdown the task.
with GPSD I have no problems.


RE: Navit install on OAP for iphone users - tthenrie - 11-02-2019

(11-01-2019, 05:52 AM)botswanabub Wrote: hi, finally I figured out the problem. I did not connect the GPSD, instead I used the hardware conncetion /dev/ttyUSB ... it seems that navit is not closing the connection when you shutdown the task.
with GPSD I have no problems.
Nice!


RE: Navit install on OAP for iphone users - tthenrie - 10-11-2020

(08-30-2019, 10:55 PM)tthenrie Wrote: UPDATED 04/22/20

This is a short help for those who, like me, like OAP, but are iphone users and therefore have no Android Auto functions. I installed Navit for my navigation and it seems to be working well. Here's how I did it.

Firstly, I have a rpi4b running the latest Buster kernel, with the latest OAP beta, 3.3.2 b2. I have also connected the Adafruit Ultimate GPS Breakout board, Adafruit, added a gps antenna, and have it configured and functioning.

after booting, you should do the initial configuration via raspbian's GUI and then update your operating system. You can use either the Raspbian configuration (raspi-config) GUI to do this or go into Terminal and do the following:

sudo apt update
sudo apt upgrade

Let those finish. If you are running an rpi4b, like I am, you may also want to update the firmware, but this is not recommended as a normal update function. Run:

sudo rpi-update

After you have done your initial configuration and rebooted, open raspbian's "Preferences" and select "add/remove software."

Enter "Navit" in the search box. Select all the files indicated below, then click "Apply" and let it install. You can also install manually through github or by following the tutorial on theRaspberry Pi Wiki, at https://wiki.navit-project.org/index.php/Raspberry_Pi, however, doing it by the add/remove function in Preferences, it will automatically be added to the raspbian menu and place the software in logical directories, so you don't have to figure all that out on your own. 

You will need to install the following:
navit-0.5.3+dsfg.1-1
navit-data-0.5.3+dfsg.1-1
navit-graphics-gtk-drawing-area-0.5.3+dfsg.1-1
navit-gui-gtk-0.5.3+dfsg.1-1
navit-gui-internal-0.5.3+dfsg.1-1

These will give you a variety of configuration options once you start configuring Navit.

After installing, you must configure the navit.xml file, located at /etc/navit/navit.xml. According to instructions in that file, you should not modify that file, but should create a copy of it at /home/pi/.navit/navit.xml (notice the "." in front of navit makes that directory a hidden directory). Now you can do your configuration in that file and it will persist through updates and upgrades.

I used a tutorial at Ozzmaker, Navigating... for the configuration settings, as I like the way his gui looks. Ozzmaker provides downloads and links for his configuration files as well as good explanations.

There are several initial settings that must be set before you will get anything out of Navit.

sudo nano /home/pi/.navit/navit.xml

Now look for the line that begins with

<config xmlns:xi=

at the end add language="eng_US" (change this to your country code, such as "eng_AU" etc.)

The line should look like:

<config xmlns:xi="http://www.w3.org/2001/XInclude" language="eng_US">

Now look for the line that starts with:

<navit center="

Use Google Maps on your iphone to get the gps location where you want Navit to set a starting location point. By default it is set somewhere in Denmark, I think. Enter that location between the quotation marks in place of what's there (no comma between the long/lat).

Next, find the line that begins with:

<gui type="

It should read:

<gui type="internal" enabled="yes"><![CDATA[

Now find

<vehicle name="Local GPS" profilename="car" enabled="yes" active="1" source="gpsd://localhost" gpsd_query="w+xj">

This is where you tell Navit where to get GPS information for navigation. Unless you have an unusual setup on your gps breakout, it should not be changed. I added "follow="2" " to cause Navit to update position every 2 seconds. This will keep your vehicle centered in the map pretty well, rather than waiting for your vehicle to reach the edge of the map before it updates. For my configuration it reads:

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

If, after you get Navit started and you don't get any gps location, or your map shows blank, the "source" setting is probably where the problem is. Different gps devices may have different settings. Use the tutorial for setting up a GPS Breakout to make sure your unit is actually working before changing this setting in Navit.

Also, to get speed in mph, in the same line where you inserted your gps location as center, add 

imperial="1"

at the end before the >.

It should read:

<navit center="YOUR GPS LOCATION" zoom="256" tracking="1" orientation="-1" recent_dest="250" drag_bitmap="0" imperial="1">

Most of that stuff is on the Ozzmaker tutorial, but you need it even if you don't use all his stuff.

The last critical setting is the map source. I recommend maps from the Navit map extractor. You can download maps from this site directly into your maps directory in the correct format to be used by Navit.

Create a convenient "Maps" directory somewhere convenient, like maybe /home/pi/Maps. Download and unpack your maps package into this directory.

Now find the line in .navit/navit.xml that starts with

<!-- If you have the reiseplaner maps...

That option should be set to "no".  Farther down, also disable the sample mapset. Keep going down to the openstreetmaps option and enable it, by replacing "no" with "yes". Now you have to tell Navit where to find your maps. The setting should look something like this:

<mapset enabled="yes">
                <map type="binfile" enabled="yes" data="/home/pi/Maps/yourmapfile.bin"/>

Make sure the Garmin mapset option is also set to "no" as you can use only one kind of mapset at a time in Navit. That is, unless you are using the Garmin maps. In that case, enable the Garmin maps instead.

You can also download maps directly from Openstreetmaps.org. They can be downloaded in various formats and include a current map of the entire world (a VERY BIG download), but you have to convert those maps to a .bin format to be usable by Navit. There is a wiki on the openstreetmap-navit wiki for this, but I haven't been able to get it to work. Don't know why. I have been successful in downloading and unpacking smaller sections of North America and converting the osm files to .bin. Still working on the .pbf conversion thing. However, the easiest is using the Navit map extractor site.

Navit has innumerable variables for setup. You can customize everything from the display to settings for your particular vehicle, bicycle, or even a horse! Do all your configuration options in this file. Save a backup of it somewhere not on your rpi SD card, so you can restore it if necessary, in case you have to re-flash your operating system.

Your Navit installation should now be working. Go back over the Ozzmaker tutorial and set anything else you find interesting from his tutorial. You can download and install his configuration files by following his instructions. For his navit.xml configuration, open his file and cut/paste it into your .navit/navit.xml file. It should work right off the bat, although you still need to configure the lines listed above according to your setup needs. If you start getting error messages when you try to run Navit, go back and do the cut/paste operation again and try again.

You can add Navit to your OAP Applications menu by creating a Navit logo image file by using an image editor, such as Preview on your mac or iphone. Make it small and save it as a .png file. Now edit your openauto_applications.ini (located at /home/pi/.openauto/config/openauto_applications.ini) file and add the following to the bottom of it:

[Application_4]
Name=Navit
Path=<path to your Navit exec file>  (This path is /usr/bin/navit on my installation)
IconPath=/home/pi/.openauto/icons/navit_48_48.png (you can find appropriate navit icons in /usr/bin/navit/icons)
Arguments=
Autostart=false

Make sure the Path points to your Navit exec file. If you followed this tutorial, it should be /usr/bin/navit. 

It is important to have the

[Applications]
Count=5

at the beginning of the file set correctly. If you have 6 applications the number will be 6. The [Application_#] for the application you are adding should be the next number in line, which is 4 in my case, since the first application is 0.  Make sure you store your navit icon in the icons folder indicated above. 

You can find a good Navit icon at /user/bin/navit/icons/navit_48_48.png after downloading Ozzmaker's icons file.

NOTE: Currently OAP limits the number of applications to a max of 8 applications. You can add other executable applications in this same manner and delete ones you don't use, but max is still 8.

Hope that works for you. Since I've installed the new OAP beta, I've had to reinstall Navit from scratch. I should have thought to save the navit.xml file and reinstalled it after the upgrade. Oh well. It helped this tutorial.

TTH

UPDATE 10/11/20:

I had to reinstall Navit on my unit and found what may be an error in my tutorial above.

On the line:

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

The notes in the Navit guide indicate that the code: follow="1" causes your vehicle's location to be updated every "n" intervals of the gps updating position. If you set this at "0" the map will move when the vehicle reaches the edge. Set it at "2" and the vehicle's position is updated every 2 seconds. The code: active="1" sets that particular vehicle as default.

So, now my config on that like is:

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

Also, the file where the navit icons is found is not /usr/bin/navit/icons.  it is /usr/share/navit/icons.

I haven't yet been able to test navit in the vehicle, though....maybe soon. Hope that didn't mess anybody up too badly.


RE: Navit install on OAP for iphone users - tthenrie - 11-09-2020

In tweaking espeak for voice announcements, I referred to the Navit Guide, linked above, and changed my configuration as follows:

<speech type="cmdline" data="espeak -s 150 -v en-us %s"/>

 Note that the %s is NOT enclosed in single quotes as indicated by Ozzmaker. Not sure what difference this makes, but the Navit Guide specifically stated the %s was not to be enclosed in quotes.

data="android" is also available for android users, but then why use navit when google maps is available? The code cvs-=15, used on this line by Ozmaker, I believe indicates 15 characters per second. The Navit guide sets the speed as -s 150 to indicate 150 words per minute (default is 160 wpm) and also sets the language or "voice" of espeak by the voice code of espeak. You can view the various voices of espeak by going to terminal and entering:

espeak --voices

For US English, the voice code is en-us.  Ozzmaker set the language for Navit under the navit tag way up at the top of the configuration file, using language="en_US", but apparently that has no effect on espeak.


RE: Navit install on OAP for iphone users - Justindu - 01-04-2021

Is there something to configure in order for the GPS data to come from the iPhone?


RE: Navit install on OAP for iphone users - tthenrie - 01-11-2021

(01-04-2021, 09:59 PM)Justindu Wrote: Is there something to configure in order for the GPS data to come from the iPhone?

Not that I know of. If we had Carplay functionality on OAP, we would be using the iphone GPS and maps app and we wouldn't need Navit or a GPS breakout.


RE: Navit install on OAP for iphone users - Justindu - 01-12-2021

(01-11-2021, 12:36 AM)tthenrie Wrote:
(01-04-2021, 09:59 PM)Justindu Wrote: Is there something to configure in order for the GPS data to come from the iPhone?

Not that I know of. If we had Carplay functionality on OAP, we would be using the iphone GPS and maps app and we wouldn't need Navit or a GPS breakout.

I see on the other thread you answered my question that the GPS breakout is required for NAVIT to work. We don't get location services or something from the iPhone BT connection, or USB connection.