FlightGear as Bluetooth NMEA GPS provider

From FlightGear wiki
(Redirected from Air Navigation (Software))
Jump to navigation Jump to search

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