Setting up Virtual Radar Server

 10.07.2016 -  Louis Kowolowski -  ~10 Minutes

Virtual Radar Server is an alternative way to visualize and consume information that is extruded by devices like PiAware   (written about here   ).

There is documentation on the VRS   website for setting up mono/Linux, but this shows how to do it on FreeBSD.

Install FreeBSD

Nothing fancy. Basic FreeBSD installation. I skipped all the pkg customization stuff and just installed binary packages for this experiment. The following pkgs ended up being installed:

accessibility/atk
accessibility/atkmm
converters/fribidi
converters/libiconv
databases/gdbm
databases/sqlite3
devel/autoconf
devel/autoconf-wrapper
devel/automake
devel/automake-wrapper
devel/bison
devel/cscope
devel/dbus
devel/dbus-glib
devel/gettext-runtime
devel/gettext-tools
devel/glib20
devel/glibmm
devel/gmake
devel/gmake-lite
devel/gobject-introspection
devel/icu
devel/libdaemon
devel/libdevq
devel/libedit
devel/libevent2
devel/libffi
devel/libglade2
devel/libnotify
devel/libpciaccess
devel/libpthread-stubs
devel/libsigc++20
devel/llvm37
devel/m4
devel/mono-addins
devel/p5-Locale-gettext
devel/pcre
devel/pkgconf
dns/libidn
editors/vim
emulators/open-vm-tools
emulators/tpm-emulator
graphics/cairo
graphics/cairomm
graphics/dri
graphics/gbm
graphics/gdk-pixbuf2
graphics/giflib
graphics/graphite2
graphics/gtk-update-icon-cache
graphics/jasper
graphics/jbigkit
graphics/jpeg-turbo
graphics/libEGL
graphics/libGL
graphics/libdrm
graphics/libepoxy
graphics/libglapi
graphics/libglesv2
graphics/png
graphics/tiff
lang/mono
lang/perl5.20
lang/python
lang/python2
lang/python27
lang/ruby22
math/gmp
misc/help2man
misc/hicolor-icon-theme
misc/pciids
misc/shared-mime-info
net/avahi-app
net/avahi-sharp
net/libdnet
net/mono-zeroconf
net/rsync
ports-mgmt/dialog4ports
ports-mgmt/pkg
ports-mgmt/portmaster
print/cups
print/freetype2
print/harfbuzz
print/indexinfo
print/libpaper
security/ca_root_nss
security/gnutls
security/libtasn1
security/nettle
security/p11-kit
security/sudo
security/trousers
shells/bash
sysutils/fusefs-libs
sysutils/gnome_subr
sysutils/mono-kmod
sysutils/tmux
textproc/expat2
textproc/libxml++26
textproc/libxml2
textproc/libyaml
textproc/p5-XML-LibXML
textproc/p5-XML-NamespaceSupport
textproc/p5-XML-SAX
textproc/p5-XML-SAX-Base
textproc/xmlcatmgr
x11-clocks/xclock
x11-drivers/xf86-input-keyboard
x11-drivers/xf86-input-mouse
x11-drivers/xf86-video-ati
x11-drivers/xf86-video-intel
x11-drivers/xf86-video-mach64
x11-drivers/xf86-video-nv
x11-drivers/xf86-video-openchrome
x11-drivers/xf86-video-r128
x11-drivers/xf86-video-vesa
x11-drivers/xorg-drivers
x11-fonts/dejavu
x11-fonts/encodings
x11-fonts/font-adobe-100dpi
x11-fonts/font-adobe-75dpi
x11-fonts/font-adobe-utopia-100dpi
x11-fonts/font-adobe-utopia-75dpi
x11-fonts/font-adobe-utopia-type1
x11-fonts/font-alias
x11-fonts/font-arabic-misc
x11-fonts/font-bh-100dpi
x11-fonts/font-bh-75dpi
x11-fonts/font-bh-lucidatypewriter-100dpi
x11-fonts/font-bh-lucidatypewriter-75dpi
x11-fonts/font-bh-ttf
x11-fonts/font-bh-type1
x11-fonts/font-bitstream-100dpi
x11-fonts/font-bitstream-75dpi
x11-fonts/font-bitstream-type1
x11-fonts/font-cronyx-cyrillic
x11-fonts/font-cursor-misc
x11-fonts/font-daewoo-misc
x11-fonts/font-dec-misc
x11-fonts/font-ibm-type1
x11-fonts/font-isas-misc
x11-fonts/font-jis-misc
x11-fonts/font-micro-misc
x11-fonts/font-misc-cyrillic
x11-fonts/font-misc-ethiopic
x11-fonts/font-misc-meltho
x11-fonts/font-misc-misc
x11-fonts/font-mutt-misc
x11-fonts/font-schumacher-misc
x11-fonts/font-screen-cyrillic
x11-fonts/font-sony-misc
x11-fonts/font-sun-misc
x11-fonts/font-util
x11-fonts/font-winitzki-cyrillic
x11-fonts/font-xfree86-type1
x11-fonts/fontcacheproto
x11-fonts/fontconfig
x11-fonts/fontsproto
x11-fonts/libFS
x11-fonts/libXfont
x11-fonts/libXfontcache
x11-fonts/libXft
x11-fonts/libfontenc
x11-fonts/mkfontdir
x11-fonts/mkfontscale
x11-fonts/xorg-fonts
x11-fonts/xorg-fonts-100dpi
x11-fonts/xorg-fonts-75dpi
x11-fonts/xorg-fonts-cyrillic
x11-fonts/xorg-fonts-miscbitmaps
x11-fonts/xorg-fonts-truetype
x11-fonts/xorg-fonts-type1
x11-servers/xorg-server
x11-themes/xcursor-themes
x11-toolkits/gtk-sharp20
x11-toolkits/gtk20
x11-toolkits/gtkmm24
x11-toolkits/libXaw
x11-toolkits/libXmu
x11-toolkits/libXt
x11-toolkits/libgdiplus
x11-toolkits/pango
x11-toolkits/pangomm
x11-wm/fluxbox
x11-wm/twm
x11/appres
x11/bitmap
x11/compositeproto
x11/damageproto
x11/dmxproto
x11/dri2proto
x11/fixesproto
x11/glproto
x11/iceauth
x11/inputproto
x11/kbproto
x11/libICE
x11/libSM
x11/libX11
x11/libXScrnSaver
x11/libXTrap
x11/libXau
x11/libXcomposite
x11/libXcursor
x11/libXdamage
x11/libXdmcp
x11/libXevie
x11/libXext
x11/libXfixes
x11/libXi
x11/libXinerama
x11/libXp
x11/libXpm
x11/libXrandr
x11/libXrender
x11/libXres
x11/libXtst
x11/libXv
x11/libXvMC
x11/libXxf86dga
x11/libXxf86misc
x11/libXxf86vm
x11/libdmx
x11/liboldX
x11/libxcb
x11/libxkbfile
x11/libxkbui
x11/libxshmfence
x11/luit
x11/pixman
x11/printproto
x11/randrproto
x11/recordproto
x11/renderproto
x11/scrnsaverproto
x11/sessreg
x11/setxkbmap
x11/smproxy
x11/trapproto
x11/videoproto
x11/x11perf
x11/xauth
x11/xbacklight
x11/xbitmaps
x11/xcalc
x11/xcb-util
x11/xcb-util-renderutil
x11/xcmsdb
x11/xconsole
x11/xcursorgen
x11/xdpyinfo
x11/xdriinfo
x11/xev
x11/xextproto
x11/xf86dga
x11/xf86dgaproto
x11/xf86miscproto
x11/xf86vidmodeproto
x11/xgamma
x11/xgc
x11/xhost
x11/xineramaproto
x11/xinit
x11/xinput
x11/xkbcomp
x11/xkbevd
x11/xkbutils
x11/xkeyboard-config
x11/xkill
x11/xlsatoms
x11/xlsclients
x11/xmessage
x11/xmodmap
x11/xorg
x11/xorg-apps
x11/xorg-docs
x11/xorg-libraries
x11/xpr
x11/xprop
x11/xproto
x11/xrandr
x11/xrdb
x11/xrefresh
x11/xset
x11/xsetmode
x11/xsetroot
x11/xterm
x11/xtrans
x11/xvinfo
x11/xwd
x11/xwininfo
x11/xwud

With this, I ended up with a graphical (capable) system, running fluxbox   . The point of this system is to run VRS, headless, so I don’t need a fancy interface. I’d be happy of VRS didn’t need a gui, but I digress.

Mono and friends

Download the mono version of the VRS tarball from the VRS site (mentioned in the footnotes).

Once you have mono installed, you can fetch the tarball for VRS (don’t get the windows installer). Unpack it into a directory (by default, it unpacks into the current directory, which is messy). I chose VRS. Because reasons, you need to create a ‘VirtualRadar.exe.config’ file in the same directory as your VirtualRadar.exe file. The contents are:

<?xml version="1.0"?>
<configuration>
    <configSections>
    </configSections>
    <startup>
        <supportedRuntime version="v2.0.50727"/>
    </startup>
    <runtime>
        <assemblyBinding  xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="Mono.Data.Sqlite"
                                  publicKeyToken="0738eb9f132ed756"
                                  culture="neutral" />
                <bindingRedirect oldVersion="2.0.0.0"
                                 newVersion="4.0.0.0" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
</configuration>

This fixes some mono/.net version mismatch/compat stuff.

You should now be able to run

mono VirtualRadar.exe

Most of the options are pretty straight forward. If you don’t know the lat/long of your basestation (PiAware?) you can use Google Maps   to find your location.

Once you get it connected, it should look similar to this.

I’ve noticed that it seems to crash if I attempt to go into options or plugins more than once. Annoying, but only at the beginning. Once things are configured, it seems moderately stable.

Virtual Radar Server Addons

Download the SQB files

Unzip this into your VRS directory that has the VirtualRadar.exe.config Download the Database Writer Plugin

This is used for keeping a history of the planes you see. When you load VRS, under Tools -> Plugins, you should s

Sample screenshots

You can point your browser at http://<your_vrs_ip>:8080/VirtualRadar/ and you should see something similar to this (Depending on where you live and how busy your skys are).

I periodically add to the gallery below as I see interesting things.

Reporting

All this is fun, but really, who has time to watch this 24/7? Since the BaseStation.sqb file is just an SQLite database, you can script queries and generate reports for yourself. A script like this will find all the flights in the last 24hrs that have an owner that starts with ‘United States’. It will then print out a collection of fields. It looks like this:

ModeS    Country        Registration  Owner                           Callsign    ICAO   Type                            Oper   Last Seen          
-------  -------------  ------------  ------------------------------  ----------  -----  ------------------------------  -----  -------------------
AE26A7   United States  6581          United States Coast Guard       CG6581      AS65   Aerospatiale MH-65D Dolphin            2016-10-09 00:07:35
AE1E6A   United States  166012        United States Navy              BOILERUP    TEX2   Raytheon Aircraft Company T-6B         2016-10-09 00:21:10
AE14AA   United States  160854        United States Navy                          BE9L   Beech T-44A Pegasus                    2016-10-09 00:22:07
AE26BA   United States  6603          United States Coast Guard       C6603       AS65   Aerospatiale MH-65D Dolphin            2016-10-09 00:45:23
ADFFC8   United States  64-13304      United States Air Force                     T38    Northrop T-38A Talon                   2016-10-09 00:55:04
AE4EAD   United States  166196        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 01:13:29
AE147A   United States  166693        United States Navy              CNV4584     B737   Boeing C-40A                           2016-10-09 01:14:38
AE1ED9   United States  166084        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 01:20:27
AE0478   United States  58-0046       United States Air Force         ZOMBE23     K35R   Boeing KC-135T                  RCH    2016-10-09 01:24:51
AE4C5F   United States  10-0729       United States Air Force         RAIL11      B350   Hawker Beechcraft Corp MC-12W          2016-10-09 01:30:34
A92FB5   United States  07-0691       United States Air Force                     PC12   Pilatus PC-XII U-28B                   2016-10-09 01:32:02
AE26BA   United States  6603          United States Coast Guard       C6603       AS65   Aerospatiale MH-65D Dolphin            2016-10-09 02:13:59
ADFCCB   United States  93-0651       United States Air Force                     BE40   Beech T-1A Jayhawk                     2016-10-09 02:26:52
AE145D   United States  06-6159       United States Air Force         RCH111      C17    Boeing C-17A Globemaster III    RCH    2016-10-09 02:29:56
ADFCB1   United States  93-0625       United States Air Force                     BE40   Beech T-1A Jayhawk                     2016-10-09 02:37:31
AE1E85   United States  166039        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 02:46:17
AE1E79   United States  166027        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 02:47:08
AE1E6A   United States  166012        United States Navy              BOILERUP    TEX2   Raytheon Aircraft Company T-6B         2016-10-09 02:49:45
AE059C   United States  60-0350       United States Air Force         OILER47     K35R   Boeing KC-135R                  RCH    2016-10-09 03:10:36
AE4C5F   United States  10-0729       United States Air Force         RAIL11      B350   Hawker Beechcraft Corp MC-12W          2016-10-09 03:41:04
AE0478   United States  58-0046       United States Air Force         ZOMBE23     K35R   Boeing KC-135T                  RCH    2016-10-09 03:53:49
AE1494   United States  97-0100       United States Air Force         DRACO21            Boeing E-8C Joint STARS         RCH    2016-10-09 10:31:46
AE2EE4   United States  166103        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 14:07:11
ADFF57   United States  68-8112       United States Air Force                     T38    Northrop T-38C Talon                   2016-10-09 15:01:32
AE4C5F   United States  10-0729       United States Air Force         RONIN20     B350   Hawker Beechcraft Corp MC-12W          2016-10-09 15:13:48
AE04F1   United States  84-00161      United States Army              PAT571      BE20   Beech C-12U-3 Huron                    2016-10-09 15:18:44
AE57C7   United States  169002        United States Navy              VVLL811     P8     Boeing P-8A Poseidon                   2016-10-09 15:32:17
AE14CD   United States  161076        United States Navy                          BE9L   Beech T-44A Pegasus                    2016-10-09 15:52:49
ADFE8A   United States  61-2666       United States Air Force         SAME40      C135   Boeing NC-135W                  RCH    2016-10-09 15:56:48
AE04D7   United States  165829        United States Navy              CNV4601     B737   Boeing C-40A                           2016-10-09 16:00:19
AE1E5A   United States  07-3890       United States Air Force                     TEX2   Hawker Beechcraft Corp T-6A Te         2016-10-09 16:44:42
AE4BEE   United States  2314          United States Coast Guard                   CN35   CASA HC-144A Ocean Sentry              2016-10-09 16:46:48
ADFE8A   United States  61-2666       United States Air Force         SAME40      C135   Boeing NC-135W                  RCH    2016-10-09 17:23:33
AE0566   United States  85-0009       United States Air Force         RCH148      C5M    Lockheed C-5M Galaxy            RCH    2016-10-09 17:36:18
AE4EBA   United States  168436        United States Navy              MADFX22     P8     Boeing P-8A Poseidon                   2016-10-09 17:59:29
AE14CB   United States  161074        United States Navy                          BE9L   Beech T-44A Pegasus                    2016-10-09 18:00:17
AE0570   United States  86-0019       United States Air Force                     C5M    Lockheed C-5M Galaxy            RCH    2016-10-09 18:00:58
A3522F   United States  N313CG        United States Dept of Justice               AT43   Avions de Transport Regional A  DOJ    2016-10-09 18:20:24
AE04F1   United States  84-00161      United States Army              PAT571      BE20   Beech C-12U-3 Huron                    2016-10-09 18:21:31
AE4C5F   United States  10-0729       United States Air Force         RONIN20     B350   Hawker Beechcraft Corp MC-12W          2016-10-09 18:26:27
AE01E3   United States  96-3011       United States Air Force                     TEX2   Raytheon Aircraft Company T-6A         2016-10-09 18:27:03
ADFC69   United States  90-0407       United States Air Force                     BE40   Beech T-1A Jayhawk                     2016-10-09 18:31:31
AE2EE4   United States  166103        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 18:31:49
ADFF57   United States  68-8112       United States Air Force                     T38    Northrop T-38C Talon                   2016-10-09 18:32:00
ADFE8A   United States  61-2666       United States Air Force         SAME40      C135   Boeing NC-135W                  RCH    2016-10-09 18:48:16
AE03EB   United States  165314        United States Navy                          C130   Lockheed C-130T Hercules               2016-10-09 19:23:31
AE0577   United States  86-0026       United States Air Force         RCH622      C5M    Lockheed C-5M Galaxy            RCH    2016-10-09 19:26:40
AE1E5A   United States  07-3890       United States Air Force                     TEX2   Hawker Beechcraft Corp T-6A Te         2016-10-09 19:40:21
AE05DA   United States  85-0041       United States Air Force         HANK41      C130   Lockheed C-130H Hercules        RCH    2016-10-09 20:00:25
AE020F   United States  79-1951       United States Air Force         PRIMO85     DC10   Douglas KC-10A Extender         RCH    2016-10-09 20:02:48
ADFE8A   United States  61-2666       United States Air Force         SAME40      C135   Boeing NC-135W                  RCH    2016-10-09 20:10:07
AE14CB   United States  161074        United States Navy                          BE9L   Beech T-44A Pegasus                    2016-10-09 20:13:42
AE0429   United States  62-3530       United States Air Force         MASH63      K35R   Boeing KC-135R                  RCH    2016-10-09 20:25:26
AE04F1   United States  84-00161      United States Army              PAT571      BE20   Beech C-12U-3 Huron                    2016-10-09 20:53:47
AE2EE4   United States  166103        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 21:02:31
AE03E7   United States  165159        United States Navy                          C130   Lockheed C-130T Hercules               2016-10-09 21:05:54
AE2F6A   United States  09-0659       United States Air Force         SAME90      B350   Hawker Beechcraft Corp MC-12W          2016-10-09 21:16:42
ADFEA1   United States  94-7321       United States Air Force         DAWG88      C130   Lockheed C-130H Hercules        RCH    2016-10-09 21:21:44
AE12B7   United States  87-0023       United States Air Force         CHAIN21     C130   Lockheed MC-130H Hercules       RCH    2016-10-09 21:41:37
AE0484   United States  62-3509       United States Air Force         BACKY91     K35R   Boeing KC-135R                  RCH    2016-10-09 21:54:38
AE4AF2   United States  08-3177       United States Air Force         HAVOC63     C30J   Lockheed C-130J-30 Hercules     RCH    2016-10-09 21:58:23
AE0859   United States  59-1506       United States Air Force         E91506      K35R   Boeing KC-135R                  RCH    2016-10-09 22:14:29
ADFC69   United States  90-0407       United States Air Force                     BE40   Beech T-1A Jayhawk                     2016-10-09 22:19:55
AE04F1   United States  84-00161      United States Army              PAT571      BE20   Beech C-12U-3 Huron                    2016-10-09 22:29:15
ADFCBE   United States  93-0638       United States Air Force                     BE40   Beech T-1A Jayhawk                     2016-10-09 22:29:44
ADFCCA   United States  93-0650       United States Air Force                     BE40   Beech T-1A Jayhawk                     2016-10-09 22:30:59
AE03E1   United States  164994        United States Navy                          C130   Lockheed C-130T Hercules               2016-10-09 22:58:00
AE0566   United States  85-0009       United States Air Force         RCH148      C5M    Lockheed C-5M Galaxy            RCH    2016-10-09 23:11:07
AE1E84   United States  166038        United States Navy                          TEX2   Raytheon Aircraft Company T-6B         2016-10-09 23:13:57
AE4AF1   United States  08-3176       United States Air Force         E83176      C30J   Lockheed C-130J-30 Hercules     RCH    2016-10-09 23:23:26
AE14D0   United States  161079        United States Navy                          BE9L   Beech T-44A Pegasus                    2016-10-09 23:27:55
AE1258   United States  166376        United States Navy              VV100       GLF5   Gulfstream Aerospace C-37B             2016-10-09 23:29:50

The script looks like this:

#!/usr/bin/env bash
set -e
date=`date -v -24H +%Y-%m-%d`
dbfile=/path/to/BaseStation.sqb
mailto='user@domain.tld'
output_file="/tmp/flights_$$.txt"


touch ${output_file}
if [ -e ${output_file} ] ; then
	SQL="select Aircraft.ModeS, Aircraft.ModeSCountry as Country, Aircraft.Registration, Aircraft.RegisteredOwners as Owner, Flights.Callsign, Aircraft.ICAOTypeCode as 'ICAO', Aircraft.Type, Aircraft.OperatorFlagCode as 'Oper', Flights.EndTime as 'Last Seen' from Aircraft INNER JOIN Flights ON (Aircraft.AircraftID=Flights.AircraftID) where Flights.EndTime like '${date}%' and Owner like 'United States%' order by Flights.EndTime ASC;"
	sqlite3 -header -column -cmd '.width 7 0 0 30 0 5 30 5' ${dbfile} "${SQL}" \
		> ${output_file} 2>/dev/null
	echo "${date}" | /usr/local/bin/mutt -s "Interesting flights from yesterday" -a "${output_file}" \
		-- "${mailto}"
fi

You can cause it to run once a day (midnight?) and email you the output. If there is something you want to get more information about, you can always come back to VRS and use its reporting to show any additional information, potentially overlayed on a map.

Summary

Everything pretty much works as advertised. I noticed that you don’t get the option to display receiver range on the map if you use merged feeds (more than one basestation contributing to the same VRS instance) which makes sense. Reports work. Its an SQLite database, so you can run your own queries against it, and even automate text based reports if you want. All in all, pretty slick.

Footnotes and References