ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

GPS navigation from Kodi

Thu Feb 09, 2017 10:13 pm

Hi forum,

I've been working on a Raspberry Pi 3 B car computer project using Kodi 18 and the official touch display with Mesa OpenGL (fkms for now) driver. I've researched and tested a couple GPS navigation solutions for the Pi.

I've tried the CarPC project (after updating outdated Navit configs, the Kodi CarPC theme, Kodi navigation addon and more so that it would work on a current Raspbian and Kodi 18 from git). I do not like it very much for a few reasons. The code and configs are outdated. The availability of updates and built-in update system (scripts) is inflexible and generally concerning to me from a long-term perspective. The latest versions of Navit (the released 0.5.0 and git development versions) seem to perform terribly slow (freezes/hangs, honestly, it's unusable) when launched from the Kodi addon. Navit seems to work fine in a standard X session.

After being disappointed with the overall functionality and performance of the CarPC system (Kodi with Navit) and not wanting to debug it further, I decided to see if there were other options. I found the Seven Ways (7ways) application which seems to work fairly well. It uses a .7w map file format (typically derived from OpenStreetMap data) and it can be tricky to convert map data in other formats (requires obscene amounts of RAM), but it is possible to download converted and reasonably up-to-date map files for most locations (when a certain website is reachable). The address search functionality does not work well. I don't think the source code is available and they only offer a precompiled "ARM" (no further specifics regarding compatibility) download. Documentation is sparse. All that aside, it seems to run fairly well for me with a USB GPS (VK-162).

To get 7ways to launch from Kodi, I created a small shell script and used the Kodi addon named Advanced Emulator Launcher. This Kodi addon is mainly focused on integrating ROMs and emulator launchers in to Kodi, but you can also run other applications using it. So I created a launcher to run the following script and added the launcher to the Kodi "Favourites":

Code: Select all

#!/bin/sh
# Check if 7ways is running
if [ "$(pidof 7ways)" ]
then
  # If it is running, then switch to the 7ways window
  /usr/bin/xdotool search --name 7ways windowactivate
else
  # If is not running, then execute it
  cd /home/pi/software/7ways
  ./7ways &
fi
exit 0
This seems to work fairly well for me as the 7ways app has a button to either close 7ways or minimize the 7ways window which sends me right back to Kodi. If I have music playing in Kodi when I launch 7ways in this manner, then unfortunately the music stops playing. I'll have to see if there is a way to prevent that. I imagine I'll need to modify the Advanced Emulator Launcher addon.

UPDATE: Preventing the music from being stopped when running a launcher (for 7ways in this case) is easily configurable in the Advanced settings for Advanced Emulator Launcher. The option is labeled "Action on Kodi playing media" which can be set to Stop, Pause or Let Play. Let Play does the trick.

I suppose I should also see if Navit can be integrated in the same sort of way (using AEL) to see if it performs any better using it this way. I'd probably need to add a custom button to the Navit interface to get back to Kodi.

UPDATE 2: Here's a similar way to integrate Navit into Kodi which seems to work OK.

/usr/local/bin/navitctl:

Code: Select all

#!/bin/sh
# Check if Navit is running
if [ "$(pidof navit)" ]; then
  if [ "$1" = "minimize" ]; then
    # If it is running and minimize arg
    # was passed then minimize the window
    xdotool search --desktop 0 --name "Navit" windowminimize
  else
    # Otherwise switch to the Navit window and maximize it
    /usr/bin/xdotool search --desktop 0 --name "Navit" windowactivate
    /usr/bin/xdotool search --desktop 0 --name "Navit" windowsize 100% 100%
  fi
else
  # If Navit is not running, then execute it
  navit &
fi
exit 0
I then created an extra minimize SVG image and used it to add a button to the Main Menu in navit.xml:

Code: Select all

<img src='gui_minimize' onclick='navit.spawn("/usr/local/bin/navitctl","minimize")'><text>Minimize</text></img>
Some quickly-made missing and extra SVG images for Navit:
https://raw.githubusercontent.com/ktb83 ... nimize.svg
https://raw.githubusercontent.com/ktb83 ... marine.svg
https://raw.githubusercontent.com/ktb83 ... urnish.svg
https://raw.githubusercontent.com/ktb83 ... _handg.svg
https://raw.githubusercontent.com/ktb83 ... owling.svg

I also checked out a project that doesn't use Kodi and instead uses a web interface with MPD backend for music in a kiosk manner. That project seems to require a mobile data connection for all functionality and doesn't seem to have full navigation with turn by turn directions. It seems to just track where you are and have been.

So, I'm wondering what solutions others have come up with and are using successfully.

Thanks for reading,
- KTB
Last edited by ktb on Fri Mar 17, 2017 1:50 am, edited 3 times in total.

pcace
Posts: 14
Joined: Sun Sep 18, 2016 9:00 pm

Re: GPS navigation from Kodi

Sat Feb 25, 2017 10:00 pm

Seems that noone uses the pi for navigation purposes...
How did you get maps into 7ways? the only maps if found working are either eastern european outdated maps or far east (also outdated) maps. osm files seem to be not recognized, and the provided converter is not working at all..

Cheers,

Pcace

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: GPS navigation from Kodi

Sat Feb 25, 2017 11:30 pm

I'm not sure I would really recommend converting the maps yourself. It's not fun to say the least.

I was able to convert a OSM file for the state of Illinois (USA), but it required somewhere around 12-13 GB of RAM if I remember correctly. The Windows 10 laptop I used has 16 GB. On Windows 10, I used a perl script (osm2mp.pl) with Strawberry Perl to convert the OSM file to MP format (Polish Map Format). Then I used the 7WaysConv64.exe program on Windows 10 to convert the MP format to 7W (7 Ways) format. I do believe there are ways to split up the OSM files into smaller pieces so that they are easier to convert, but I didn't try that. osm2mp.pl coupled with Windows 10's poor memory management is a fairly impressive combination.

For which areas are you trying to locate maps?

I was also able to download an Illinois map in 7W format from megamaps.org, but that website seems to frequently be unavailable for some reason.

megamaps.org/index.php?a=s

Specify your card:
navigation program / section: Navikey Seven Roads
Map of the country: America (United States / USA)
Select a card: Illinois (Eng. Illinois)
-----------------------------------------------------
Download Mirror already downloaded:
The date and file size: 16.02.2017 425.25Mb

My only advice for megamaps.org is that you keep trying (sorry).

Hall17
Posts: 2
Joined: Fri May 26, 2017 9:01 pm

Re: GPS navigation from Kodi

Fri May 26, 2017 9:05 pm

Dear KTB,
Firstly thank you for this tutorial this is what I am trying to do in my project right now , an integrated system kodi and navigation together , but I don't know how to use Advanced Emulator Launcher to create a launcher. Can you explain it further please ?
Thanks.
Last edited by Hall17 on Sat May 27, 2017 4:14 pm, edited 1 time in total.

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: GPS navigation from Kodi

Sat May 27, 2017 9:17 am

Hall17 wrote:Dear KTB,

Firstly thank you for this tutorial this is what I am trying to do in my project right now , an integrated system kodi and navigation together , but I don't know how to use Advanced Emulator Launcher to create a launcher. Can you explain it further please ?
Thanks.
Well, I believe the first thing you would want to do is compile Kodi with X11 support. The Kodi versions you can install via APT from the Raspbian and RPF repos do not include X11 support. Otherwise, when you try to launch an application using the AEL Kodi add-on, that application will appear behind the Kodi GUI. This can be a little tricky. I'm currently using Raspbian Stretch, the 4.9.28-v7+ kernel with vc4-fkms-v3d overlay and Kodi 18.x (compiled from the master GitHub branch). Prior to compiling Kodi, I remove/move the older versions of Broadcom libs which conflict with Mesa libs (/opt/vc/lib/libEGL.so, /opt/vc/lib/libGLESv2.so, /opt/vc/lib/libOpenVG.so, /opt/vc/lib/libWFC.so, /opt/vc/lib/pkgconfig/egl.pc, /opt/vc/lib/pkgconfig/glesv2.pc, /opt/vc/lib/pkgconfig/vg.pc) and run sudo ldconfig. I also compile FFmpeg which I use with my Kodi builds. I think this is the last way I configured Kodi:

Code: Select all

cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DFFMPEG_PATH=/usr/local -DENABLE_INTERNAL_FFMPEG=OFF -DCORE_SYSTEM_NAME=linux -DENABLE_NEON=ON -DENABLE_EVENTCLIENTS=ON -DENABLE_OPENGL=ON -DENABLE_X11=ON -DENABLE_VAAPI=OFF -DENABLE_VDPAU=OFF -DENABLE_MDNS=OFF
After you have Kodi working with X11 support, using the AEL add-on should be fairly easy. There are installation instructions here -- https://github.com/Wintermute0110/plugi ... r.launcher and various release ZIP files here -- https://github.com/Wintermute0110/repos ... r.launcher. You can install the AEL add-on as a ZIP file (Kodi: Settings > Add-ons > Install from zip file). After creating a custom shell script to launch/control the navigation application (like the example scripts I posted), you can create a new launcher for it in the AEL add-on. In Kodi, you would go to Add-ons > Program add-ons > Advanced Emulator Launcher where you should see a category list which is primarily focused on Emulators and ROMs. Here you can right-click on the "<Favourites>" category item to reveal a context menu which includes the option "Add New Launcher." Click/select "Add New Launcher" which will pop up a "Create New Launcher" dialog window. Click/select the "Standalone Launcher (Game/Application)" option. That option will open a new dialog window titled "Select the launcher application." Here you can navigate through the file system to locate and choose the shell script you created to launch a navigation application (For example, Root filesystem > usr > local > bin > navitctl). After clicking/selecting OK, it will ask if you want to pass any arguments to the script/application you want to launch (I just leave that empty). After clicking/selecting OK again, it will ask for a title for the launcher (For example, "Navit"). After clicking/selecting OK again, it will ask you to "Select a platform". Here you can just scroll to the bottom of the list and choose the "Unknown" option. After that, a new launcher will be created with whatever title you chose. You can right-click on the new launcher and use the "Add to favorites" option if you'd like. That will add the launcher to the Favorites category in Kodi's main menu which is more convenient than having to go to the AEL add-on and using the launcher from there.

If you need further step-by-step instructions and can be patient, I may be able to put those together.

Hall17
Posts: 2
Joined: Fri May 26, 2017 9:01 pm

Re: GPS navigation from Kodi

Sat May 27, 2017 10:46 am

Dear ktb , thank you for this great post. You already spent a large amount of time for me. Unfortunately , I am not an expert in this field (Raspberrypi and Linux) and I am working on this for my school project. I have limitless patience but my professors don't :P There is a deadline and it is getting closer. I am trying to understand what you explained and I will try to do it on my own , but It would be amazing if you explained it step-by-step for newbies as me. I guess I already created a launcher correctly and as you said my kodi probably doesn't support X11 so that's why it didn't work. Another thing is , you mentioned that you used CarPC before. I am also trying to find a solution for the black screen problem when I click navigation. I guess it is also related to X11 support. You maybe give me a solution also about this because My project will be done when either of these problems is done.
Thank you again for your great effort,
Best Regards.
Last edited by Hall17 on Sat May 27, 2017 4:15 pm, edited 2 times in total.

ktb
Posts: 1380
Joined: Fri Dec 26, 2014 7:53 pm

Re: GPS navigation from Kodi

Sat May 27, 2017 11:26 am

Hall17 wrote: Dear ktb , thank you for this great post. You already spent a large amount of time for me. Unfortunately , I am not an expert in this field (Raspberrypi and Linux) and I am working on this for my school project. I have limitless patience but my professors don't :P There is a deadline and it is getting closer. I am trying to understand what you explained and I will try to do it on my own , but It would be amazing if you explained it step-by-step for newbies as me. I guess I already created a launcher correctly and as you said my kodi probably doesn't support X11 so that's why it didn't work. Another thing is , you mentioned that you used CarPC before. I am also trying to find a solution for the black screen problem when I click navigation. I guess it is also related to X11 support. You maybe give me a solution also about this because My project will be done when either of these problems is done.
Thank you again for your great effort,
Best Regards.
Sure, no problem. I'd appreciate it if you would avoid quoting my long posts. It makes threads redundant, less useful to others. I'm not able to edit that quoted post content in the future if I choose to update some information or correct something. You can edit the posts you made in this thread to remove my long post content from your posts.

I'm not sure how you installed the CarPC project, but the only way to have working navigation which I'm aware of is to use a pre-compiled custom Kodi 15.2 (which has some mouse event patches and is included in the CarPC installation ZIP file). I don't think anyone has been able to get the CarPC Navigation add-on working in Kodi 16 or 17 yet, but I could be wrong. I too have seen the black screen problem when trying to use a couple of different CarPC skins with the navigation add-on. Navit doesn't work very well using the CarPC project, IMO (for one, you can't drag/move the view-port around the map). Unlike the Kodi-with-X11-support method I've described, the CarPC skin and navigation add-on basically uses a transparent window/layer so that Navit can be seen behind Kodi while detecting mouse clicks/taps on the transparent Kodi layer and sends them to Navit (which still remains behind/below Kodi).

The last time I tried the CarPC project, I used the ZIP file available from here -- http://raspicarprojekt.de/showthread.php?tid=1014 (Google translate to English: https://translate.google.com/translate? ... tid%3D1014). You may want to change the regional/language/keyboard settings in Kodi after installation, because I believe it's set to German/QWERTZ by default.

krevedkoman
Posts: 1
Joined: Sat Apr 13, 2019 1:48 pm

Re: GPS navigation from Kodi

Sat Apr 13, 2019 1:51 pm

can somebody build kodi with X11 support?

Return to “Media centres”