Sunday, 30 December 2012

Flight planning on the Raspberry Pi (!)

This is not a New Year wind-up. So, please keep reading. Having bought a Raspberry Pi for my 11 year-old son for Christmas, I couldn't resist trying it out with iNavCalc for flight-planning.

If you don't know what a Raspberry Pi is (an ARM/Linux computer for $25), visit this link for an intro.

Here it is, ready  to be connected-up to my TV, ethernet hub, and USB mouse/keyboard (shown beside a $10 bill to show the scale!):


...and here's how you connect it up (image courtesy of RaspberryPi.org):



When you power it on, you get the unix (linux) command-prompt:



...an almost magical breath of fresh air in this day-and-age! If you don't agree with that comment, abandon this post. It is not for you. If you do, read on...

The whole point of the Raspberry Pi is to provide a sensible "bare-bones" platform for teaching kids how to write software, uncluttered by all the fancy stuff that comes pre-packaged with a modern consumer-oriented device such as a Windows or Mac desktop, Android tablet/phone,  iPad/iPhone or other such tablet/smartphone.

In terms of programming languages, the Raspberry Pi comes with Python pre-installed, so this is the natural starting point for code-development. However, I will leave that for another day. Instead, for now I'll simply fire-up the Chromium web-browser to test out the iNavCalc web-app interface. Note: Chromium (basically a flavour of Google Chrome which is suitable for the Raspberry Pi) doesn't come pre-installed out-of-the-box on the Raspberry Pi, but it is easy to install. I first tried the Midori browser which does come pre-installed, but the GoogleMaps (used by iNavCalc) didn't seem to load correctly...

Here, then,  is the iNavCalc web-app successfully rendered on Chromium on the Raspberry Pi showing a simple straight-line sample route from EGNS (Isle of Man) to EGPF (Glasgow):









...and here is the corresponding "Get detailed PLOG" pop-up...







...and here is the response email (via Gmail, also rendered in Chromium on the Raspberry Pi)...






...demonstrating the full functionality of the iNavCalc web-app, just like on a Windows PC or iPad, etc.

Of course, this only demonstrates that the Raspberry Pi browser works as desired when rendering the FlyLogical website. But it's a start: and it gives me yet another device to use for flight-planning when all the "real" computers in the house are taken-up (for games and shopping, etc.)

On a more serious note: since I've written the iNavCalc software suite to make extensive use of web-services from the ground-up, it represents a fun and feasible challenge to build a client app (e.g., using Python)  to "consume" these web-services on the Raspberry Pi. I'll leave that for another day...and hopefully convince my 11 year-old to help me.




Wednesday, 26 December 2012

Garmin 795 Flight Plans now supported

Update 18 April 2017: completely re-written iNavCalc mobile apps with streamlined command-line interface for iOS, Android, and Windows 10

Update: the desktop browser version of the iNavCalc web-app now supports import & export of gpx and fpl files, making it simple to transform between the two formats in any either direction.

Update: with Version 3.0 of the iNavCalc mobile app on Android, you can now import an ".fpl" (or ".gpx") file by clicking on the file (within the Android file-system, e.g., on the SDCARD). Export to ".gpx" (or".fpl") is still carried-out via the iNavCalc email functionality, described below.

Update: see recently-added Route Viewer which further extends the route-sharing capabilities of iNavCalc...

I have now added support for Garmin AERA 795/796 (and Garmin 1000) flight-plan files (".fpl" format) to the FlyLogical iNavCalc flight planning email- and web-apps. This allows you to conveniently import/export routes to/from your Garmin device (via the SD card) to your other software tools and devices.

Why did I do this ? Simple: because I own a Garmin 795 and find it to be a fantastic piece of kit. Far better (in terms of usability, system stability, robustness) than the iPad for use in the cockpit environment. All that was missing was a convenient means of sharing my routes with the unit...now solved. See step-by-step examples below.

Usage Example 1: Exporting a route from the Garmin 795 into iNavCalc and beyond

First create and save a route (known as a "flight plan") on the Garmin (refer to the Garmin user guide for instructions on how to do this). The screenshot below shows some example routes in my AERA 795, with the "EGQL-EGSF" route selected in the list (highlighted). We will use this in the export example.


To prepare for export, you need to save the route to the removable SD card in the Garmin (required for all data transfers to/from the Garmin). Make sure you have an SD card inserted in the device, select the desired route for export (as highlighted above, "EGQL-EGSF" in the example) then  press the menu options button on the FPL List page. You will see the following options:


Click "Export Flight Plan" (the last item in the menu). You will receive the following acknowledgement:


which confirms that the route has been successfully exported on to the SD card, under the file name "EGQL-EGSF.fpl". Click "OK", shut-down the Garmin, remove the SD card, insert it into a PC (via a built-in SD card slot or via a portable USB SD card-reader peripheral), then browse the contents of the SD card. You should see the directory list as follows:


You should see your exported route in the root (top level) of the directory-listing, as highlighted in the above screenshot.

The exported ".fpl" file  is simply an XML file, structured in accordance with Garmin's own "legacy" schema. If interested, you may open the file with a text-editor to review the contents which are human-readable and generally intelligible, but not very useful until transformed. So, the next step is to transform this ".fpl" file into a portable ".gpx" format which can then be used in wide range of third-party software tools and devices. 

The FlyLogical iNavCalc app does all the grunt work of transforming the file from ".fpl" into ".gpx". Simply prepare an email to recipient plogs@flylogical.com with the ".fpl" file as an attachment. The subject-line and body of the email can be left blank. The screenshot below shows such an email, ready to be sent.


Send the email. In a few seconds you will receive a response, with four attachments, as shown in screenshot below:


Three of these files are the familiar products delivered by iNavCalc's email-based flight planning calculator. Namely, the "ROUTE_....gpx" file, the "PLOG_....pdf" file, and the "MET_....pdf" file. Of specific interest to the current task is the "ROUTE_...gpx" file which is the transformation of the original ".fpl" file into the open-standard GPX format which is supported by many apps such as, for example, SkyDemon, AirNavPro, Memory-Map, as well, of course, as iNavCalc.

The fourth attachment, the "GARMIN795_...fpl" file, is a new feature in iNavCalc. It is a version of the route,  formatted in the ".fpl" format for ease-of-import to the Garmin device. More on this in the next usage example below.

Usage Example 2: Importing a route into the Garmin 795 


Now let's go the other way. Let's create a route outside the Garmin, and import it so it becomes available as a Flight Plan in the 795. For this example, I will create the route using iNavCalcs's email interface which enables you to define the waypoints in a "natural" manner rather than having to pick them from a list or from a map view (as per popular map-centric software utilities such as SkyDemonAirNavProMemory-Map, etc). Specifically, I'll use as an example, the route prepared in my previous post "Flight route-planning the old fashioned-way -- almost...". Simply specify the waypoint ICAO names and/or navaid radials as desired, separated by spaces, on the email subject-line, and send to plogs@flylogical.com:



That's it. A few seconds later, you will receive a response with the following attachments:

For present purposes, the file named "GARMIN795_...fpl" is the one of primary interest. This contains the desired route, encoded in Garmin's ".fpl" format. Simply download the attachment from the email, and save it in the root (top level) location on the Garmin SD card ( via a built-in SD Card slot on your PC or via a portable USB SD card-reader peripheral), as highlighted in the screenshot below:


Now insert the SD Card into the Garmin, power it on, go to "FPL List", select the options menu, and you should see the following list (from before):


Click "Import Flight Plans" (the second-last item in the menu). You will be presented with a list of  ".fpl" files available on the SD card, as follows:



Select the desired entry, in this case the "GARMIN795_a0aa2........fpl". The route will be imported. If successful, you will receive the following acknowledgement:


where, in this case, the route has been imported under the title "EGPK-EGQL 1". Click "OK", then return to the "FPL List". You will see your imported route in the list, in this case under the heading "EGPK-EGQL 1", highlighted in the screenshot:



Now click on the entry, and you will see the route in the 795 ! Job done !...


Implementation Notes

When iNavCalc carries out the conversion from of  the ".gpx" file to the ".fpl" file format:
  • All blank spaces and non-alphanumeric characters are removed from the waypoint names since these would cause those waypoints to be omitted during the Garmin import process. 
  • Since the ".fpl" format expects (essentially) NAME, LAT, LON, TYPE and COUNTRY for each waypoint, but the ".gpx" (in it's minimal, most general version) specifies (essentially) only NAME, LAT, LON, then iNavCalc  attempts to "back fill" the missing TYPE and COUNTRY fields via the following matching algorithm:
    • A search is made against iNavCalc's internal database looking for the geographically nearest entry which has the same NAME as the waypoint in question.
    • If a match is found, then the TYPE and COUNTRY are taken from the iNavCalc database, Note: the TYPE is mapped to those supported by the Garmin ".fpl" schema, namely: "AIRPORT", "VOR", "NDB", "USER WAYPOINT", "INT", which is a subset of the categories available in the iNavCalc's internal database.
    • Otherwise, the TYPE is defaulted to "USER WAYPOINT" (recognized by Garmin), and a search is made against iNavCalc's internal database looking for the geographically nearest entry, regardless of NAME. The COUNTRY of the result of the search is used. 
During the ".fpl" importation process carried out by the Garmin device, the following rules apply:
  • If a waypoint from the ".fpl" file happens to share NAME, TYPE, and COUNTRY with a waypoint already present in the Garmin devices's internal database, then the Garmin internal LAT and LON take precedence over those passed-in via the ".fpl" file. In this way, the location of waypoints in the Garmin internal database are unaffected by any alternative values passed-in for the same waypoint identifier.
  • If a waypoint from the ".fpl" file is not recognized as a pre-existing entry in the Garmin devices's internal database, then a new waypoint with given NAME (and of type "USER WAYPOINT") is created on the device. This waypoint thereafter automatically appears in "User WPT" listing.

Testing

I've successfully tested the functionality described above on a Garmin AERA 795 with software version 3.0.0 (since this is the device/version I own). I have not tested on any other device or version (e.g., Garmin AERA 796, Garmin 1000 etc), but as long as the same ".fpl" format is supported via SD card media (which I understand to be the case for the Garmin AERA 796 and Garmin 1000), then it should all work fine. If you happen to try on other such devices, please let me know how it works out, and I will update this post to reflect those experiences, accordingly.

DISCLAIMER

By making use of this functionality on your Garmin device, you do so at your own risk. FlyLogical assumes no responsibility, either with regard to the functionality of your Garmin device, or with your usage of the information generated via FlyLogical.