On Thu, Nov 4, 2010 at 11:32 AM, I wrote:
> Hi All,
>
> I recently came across http://www.marinetraffic.com/, which tracks
> shipping by means of their AIS transmitter, which all vessels over 299
> gross tonnes must carry.
>
> The data is transmitted by radio and includes position, speed, course,
> rate of turn, as well as the vessel type, dimensions etcs.. The
> project collects the data from various volunteer receivers and
> collates it into a DB, and provides mash-ups over Google maps etc.
>
> I think there could be a very nice little project to incorporate a
> data feed from their server through a proxy and into our MP network,
> displaying marine traffic in real-time. This would completely obviate
> the need for AI shipping routes, and at a stroke, the sea in FG would
> become accurately populated.

Having a bit of spare time over the weekend, I put together a pretty
simple perl script to act as a proxy between the marinetraffic website and
FlightGear.

At a high level the proxy works as follows:

0) FG is pre-provisioned with 40 AI ships at start of day
1) The script gets the current aircraft position from the property system over
the telnet interface
2) The script make an HTTP request to marinetraffic.com to get all the ships
within a 1 degree x 1 degree square centred on the aircraft position.
3) For each of the ships, the script sets the type, position, speed
and heading of an
AI ship with the data using the telnet interface again.

The resulting screenshot isn't particularly impressive, but it does look more
 realistic than the distribution and heading of the normal
materials.xml random ships:

http://www.nanjika.co.uk/flightgear/ships.jpg

The screenshot shows a couple of container ships (one with a tug at
the front which
has the wrong model) making their way up the Firth of Forth near
Edinburgh. In the
distance you can just make out a ship berthed at Grangemouth.

There are a couple of limitations with this approach
- We have to pre-define the number of AI ships in an AI scenario. I've got 40
on my system, but I don't have a good feel for what the overhead of each AI
ship is. If the script finds more than 40 ships when searching, it reduces the
search area and tries again. It would be much easier if we could define AI
objects at runtime.
- The telnet interface is very slow. It takes a couple of minutes to read and
write the various properties.
- The current proxy causes a per-client load on the marinetraffic website. I've
emailed for permission to use the data feed, but I doubt they'll be
too happy if we
were to integrate this into FG itself and have a couple thousand
clients requesting
data every couple of minutes. I think some approach which uses the raw NMEA data
to get and then feeds it into the MP network would be better.
Unfortunately its not
clear how we can do that.
- Close to shore, ships seem to change their course such that a
snapshot of position,
speed and heading every couple of minutes is insufficient so we get
"jumps" with each
update. I think a better model might be to use the data as a sequence
of waypoints, but
I haven't investigated to see how easy that would be to implement.

I've emailed the marinetraffic website for permission to use the XML
feeds that I've
reverse engineered and to see if they are interested in helping us with some raw
data.

Once I've permission I'll put together a package with the proxy and
the various other
changes so people can have a play.

-Stuart

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to