21 July 2012

Data mining with gr-air-modes and sqlite.

I spent some time doing data entry last night.  I was too tired to write a script to scrape data, so I just manually keyed in the list of callsigns and units from banterops.com so I could identify some aircraft that I couldn't track.

This allowed me to see a fair bit more info about what was in the air.

20 July 2012

Adventures with sqlite and gr-air-modes

In the last week I've been dabbling with sqlite.  Whilst dabbling, it occurred to me that I already had a potentially interesting sqlite database to play with. I've been putting my rtl-sdr dongle to good use, and have gr-air-modes running full-time on the linux box in the shack, so I'd already collected a large ammount of Mode-S data to try mining with sqlite queries.

I figured out that probably the most interesting thing to do would be to determine which aircraft didn't broadcast their positions.

My intial attempts to get lucky with select queries yielded either a syntax error, or an empty result.  I decided to reduce the degree of ignorance that I was applying to the problem, and resorted to google.

After google hit me with the cluebat, I  cooked up a query:

SELECT ident.ident
FROM ident LEFT JOIN positions
ON ident.icao = positions.icao
WHERE positions.icao is NULL;

This produced a bunch of callsigns, but ran like a dog. As the database I was working with grew larger, I began to have locking issues and had to bodge my working branch of gr-air-modes more heavily to keep it running.

Some more googling dug up a faster query format for me:

SELECT  ident.ident
FROM ident AS ident
LEFT JOIN (select distinct icao from positions) AS positions
ON ident.icao = positions.icao
WHERE positions.icao IS NULL;
This ran much faster than my original (0.4 secs vs. 4.5 secs on a 10MB db).

I decided to create a view, stored permanently in the database, so I didn't have to keep repeating myself:
CREATE VIEW "Untracked"
AS SELECT ident.icao, ident.ident
FROM ident AS ident
LEFT JOIN (select distinct icao from positions) AS positions
ON ident.icao = positions.icao
WHERE positions.icao IS NULL ;
The view can be invoked by
SELECT * from untracked; 
I've not yet been able to get the icao column contents formatted as hex within the query results.

I'm currently going through the process of merging my gr-air-modes tweaks back to the mainline upstream, as they were originally based on the rtl-sdr fork. I've added timestamps to all the entries in the ident table, and I'm just about to bodge the code to store all received ident message instances in the database

I've been doing all of this on Linux, using both the sqlite3 shell utility, or with Sqliteman, both of which are working well. 

10 July 2012

Quick bodge to run multiple instances of gqrx

I wondered if I could get multiple instances of gqrx running at the same time, but it seemed that the config file used at startup was hard-coded.  I contrived a quick bodge to get two instances running so I could use my USRP and my FCD at the same time.

Modifying line 54 of applications/gqrx/main.cpp to use the first argument, if present, as the config file name seems to have worked, in that it has let me run 2 instances with different config files that were previously saved.  If I give an invalid file-name as the first argument, it forces the configuration dialogue box to be shown.
    MainWindow w((argc > 1)?a.arguments()[1]:"default.conf");

9 July 2012

A quad tilt-rotor for KSP

I've now cobbled  together an un-manned quad tilt-rotor craft for KSP.  This thing is pretty tricky to fly.

7 July 2012

My first flyable tilt-rotor craft in Kerbal Space Programme

I managed to get it airborne and land it. No Kerbals were harmed in this experiment.