Difference between revisions of "FlightGear as Bluetooth NMEA GPS provider"

From FlightGear wiki
Jump to navigation Jump to search
m (Slawekmikula moved page Air Navigation (Software) to FlightGear as Bluetooth NMEA GPS provider: Navigation software does not exists but the recipe for connecting FG as GPS provider is OK. Will extend it later with screens.)
(added screens & explanation)
 
Line 1: Line 1:
'''[http://www.dixdouze.com/xample/index.php/airnavigation Air Navigation]''' is a real-time [[aircraft]] moving map navigation application for iPhone, iPad and Android by Xample. It contains free maps of the entire world as well as official IFR and VFR charts for many countries for an extra fee. It includes thousands of airports and waypoints, elevation information and features route planning and DIRECT-TO orders.
+
== FlightGear as GPS position provider to other devices via Bluetooth ==
  
Air Navigation was developed to be used as a support instrument for general aviation in the real world. Nevertheless, it can be linked to flight simulators. As the authors say, "this is a great feature for training at home when bad weather prevents real flying! Also, simulator enthusiasts can add a full moving map system to their Sim setup."
+
FlightGear can act as a GPS current aircraft location provider for other software/devices via GPS/NMEA protocol. In order to do this one have to configure FlightGear to send this information and to configure host computer as a Bluetooth NMEA provider via virtual COM (rfcomm). This recipe is provided for Linux boxes.
 
 
Xample provides plug-ins to connect X-Plane and Microsoft Flight Simulator to Air Navigation. This article explains how connect [[FlightGear]] to Air Navigation Pro using Bluetooth.
 
  
 
== Linux on the PC, Android on the mobile device ==
 
== Linux on the PC, Android on the mobile device ==
Line 9: Line 7:
 
This guide uses Debian Linux. Other distributions such as Ubuntu should be similar.
 
This guide uses Debian Linux. Other distributions such as Ubuntu should be similar.
  
Note: at the end of the guide, your Android device will believe that your PC is an external GPS unit. Hence, you can use any map application of your choice. Air Navigation is especially focused on aircrafts during real trips so it is exactly the real thing, but you can also try cheaper alternatives such as [https://play.google.com/store/apps/details?id=net.osmand OSMAnd], [https://play.google.com/store/apps/details?id=com.orux.oruxmaps OruxMaps] or Google Maps/Earth.
+
Note: at the end of the guide, your Android device will believe that your PC is an external GPS unit. Hence, you can use any map application of your choice. You can also try Android software such as [https://play.google.com/store/apps/details?id=net.osmand OSMAnd], [https://play.google.com/store/apps/details?id=com.orux.oruxmaps OruxMaps] or Google Maps/Earth. Screens comes from the Avia Maps Android software [https://play.google.com/store/apps/details?id=com.mytowntonight.aviamap].
  
 
=== Preparations (only once) ===
 
=== Preparations (only once) ===
Line 20: Line 18:
 
* Switch on Bluetooth communications on your mobile device and your PC
 
* Switch on Bluetooth communications on your mobile device and your PC
 
* Pair your mobile and your PC, if they are not paired yet. In Android: Configuration->Wireless->Bluetooth settings->Make device discoverable. In your PC, use a GUI such as BlueDevil (KDE) or gnome-bluetooth (Gnome) to locate and pair your device. You probably have to enter a PIN number on both devices.
 
* Pair your mobile and your PC, if they are not paired yet. In Android: Configuration->Wireless->Bluetooth settings->Make device discoverable. In your PC, use a GUI such as BlueDevil (KDE) or gnome-bluetooth (Gnome) to locate and pair your device. You probably have to enter a PIN number on both devices.
* Install a Bluetooth GPS on your mobile device, such as [https://play.google.com/store/apps/details?id=googoo.android.btgps Bluetooth GPS] or [https://play.google.com/store/apps/details?id=com.turboirc.bgp.v1 Bluetooth GPS Provider]
+
* Install a Bluetooth GPS on your mobile device, such as [https://play.google.com/store/apps/details?id=googoo.android.btgps Bluetooth GPS] or [https://play.google.com/store/apps/details?id=com.turboirc.bgp.v1 Bluetooth GPS Provider]. Screens comes from Bluetooth GPS software.
 
* Allow mock locations in your phone: Settings->Applications->Development->Allow mock locations. Note: for security reasons, you probably want to switch mock locations off while not using FlighGear.
 
* Allow mock locations in your phone: Settings->Applications->Development->Allow mock locations. Note: for security reasons, you probably want to switch mock locations off while not using FlighGear.
  
Line 26: Line 24:
  
 
* Switch on Bluetooth communications on your mobile device and your PC. In the Android device, switch mock locations on if they are not active (Settings->Applications->Development->Allow mock locations)
 
* Switch on Bluetooth communications on your mobile device and your PC. In the Android device, switch mock locations on if they are not active (Settings->Applications->Development->Allow mock locations)
* Register the PC as a GPS provider and listen to incoming communications. From the command line (the port number can be any port not in use. In this example port 23 is used, and this is usally a safe value):
+
* Register the PC as a GPS provider and listen to incoming communications. From the command line (the port number can be any port not in use. In this example port 23 is used, and this is usually a safe value):
  
 
<pre>sdptool add --channel 23 SP
 
<pre>sdptool add --channel 23 SP
Line 42: Line 40:
 
<pre>--nmea=file,out,5,/dev/rfcomm0</pre>
 
<pre>--nmea=file,out,5,/dev/rfcomm0</pre>
  
* Open Air Navigation or any other map application supporting mock locations and enjoy.
+
* Open Android navigation software or any other map application supporting mock locations and enjoy.
 +
 
 +
Avia Maps
 +
 
 +
[[File:Avia maps with location simulation.jpg|250px|Avia maps screen]]
 +
 
 +
Bluetooth GPS main screen
 +
 
 +
[[File:Bluetooth gps - main screen.jpg|250px|Bluetooth GPS main screen]]
 +
 
 +
Bluetooth GPS configuration
 +
 
 +
[[File:Bluetooth gps configuration (channel).jpg|250px|Bluetooth GPS configuration]]
 +
 
 +
Bluetooth GPS channel config
 +
 
 +
[[File:Bluetooth gps channel config.jpg|250px|Bluetooth GPS channel config]]
 +
 
  
[[Category:Software]]
+
[[Category:FIXME]]

Latest revision as of 22:26, 2 January 2021

FlightGear as GPS position provider to other devices via Bluetooth

FlightGear can act as a GPS current aircraft location provider for other software/devices via GPS/NMEA protocol. In order to do this one have to configure FlightGear to send this information and to configure host computer as a Bluetooth NMEA provider via virtual COM (rfcomm). This recipe is provided for Linux boxes.

Linux on the PC, Android on the mobile device

This guide uses Debian Linux. Other distributions such as Ubuntu should be similar.

Note: at the end of the guide, your Android device will believe that your PC is an external GPS unit. Hence, you can use any map application of your choice. You can also try Android software such as OSMAnd, OruxMaps or Google Maps/Earth. Screens comes from the Avia Maps Android software [1].

Preparations (only once)

  • Install Air Navigation on the mobile device. This guide will use Air Navigation Pro (the paid version of Air Navigation)
  • Install bluez on your PC, and a suitable GUI for your window manager (bluedevil for KDE, gnome-bluetooth for Gnome)
sudo apt-get install bluez-tools bluedevil
  • Switch on Bluetooth communications on your mobile device and your PC
  • Pair your mobile and your PC, if they are not paired yet. In Android: Configuration->Wireless->Bluetooth settings->Make device discoverable. In your PC, use a GUI such as BlueDevil (KDE) or gnome-bluetooth (Gnome) to locate and pair your device. You probably have to enter a PIN number on both devices.
  • Install a Bluetooth GPS on your mobile device, such as Bluetooth GPS or Bluetooth GPS Provider. Screens comes from Bluetooth GPS software.
  • Allow mock locations in your phone: Settings->Applications->Development->Allow mock locations. Note: for security reasons, you probably want to switch mock locations off while not using FlighGear.

Setup (every time)

  • Switch on Bluetooth communications on your mobile device and your PC. In the Android device, switch mock locations on if they are not active (Settings->Applications->Development->Allow mock locations)
  • Register the PC as a GPS provider and listen to incoming communications. From the command line (the port number can be any port not in use. In this example port 23 is used, and this is usually a safe value):
sdptool add --channel 23 SP
sudo rfcomm listen rfcomm0 23
  • Establish a connection from your mobile device to your PC: open the Bluetooth GPS application in your mobile device and connect to your PC. In the console, a "connection established" message must appear. If the mobile fails with a message similar to "Service Discovery failed", try to reboot your mobile device. If the PC fails with a message similar to "not authorized", check that you are running rfcomm as root (using sudo) Check if your Bluetooh GPS application sends mock locations to the system.
  • If the connection is established, check permissions in /dev/rfcomm0 Usually, members of the group dialup are allowed to write /dev/rfcomm0. If the user running FlighGear is not in the dialup group, either add the user to the group or change the permissions of /dev/rfcomm0
sudo chmod 766 /dev/rfcomm0

Note: if necessary, the group of /dev/rfcomm0 can be set using udev rules: https://bugs.launchpad.net/ubuntu/+source/udev/+bug/374782

  • Run FlightGear using this option. If you run FlightGear from the launcher FGRun, you can set this option in the Advanced tabs, section "Input/Output" (Protocol: nmea, Medium: file, Direction: out, Hz: 5, File: /dev/rfcomm0)
--nmea=file,out,5,/dev/rfcomm0
  • Open Android navigation software or any other map application supporting mock locations and enjoy.

Avia Maps

Avia maps screen

Bluetooth GPS main screen

Bluetooth GPS main screen

Bluetooth GPS configuration

Bluetooth GPS configuration

Bluetooth GPS channel config

Bluetooth GPS channel config