Board index FlightGear Development AI Traffic

Populate AI Traffic with real traffic

Intelligent, computer controlled vehicles that drive/fly over the planet!

Re: Populate AI Traffic with real traffic

Postby Hooray » Thu May 15, 2014 10:54 pm

HJ1AN wrote in Thu May 15, 2014 11:27 am:That's a shame. It'd be great if there is an option to track just one or two flights though, and follow it around or formation flight


We now have HTTP client bindings available to Nasal, which basically means that you can process JSON/XML feeds directly from FG.
So you can download some live data, parse it and populate Nasal data structures.

so you can still do something like this with less than 50 lines of code - it would just be running locally obviously.

In fact, as a quick hack, you can simply use the MapStructure framework to do this: copy the TFC.lcontroller file and change its searchCmd() to run such a query regularly.
Rename the whole thing to "FEED.lcontroller" and change the name at the top of the lcontroller/symbol files

As long as you're adding a MapStructure-based instrument (e.g. Gijs' ND) to your aircraft (not just as a GUI dialog), that traffic feed will be regularly processed.
If in doubt, use the 747-400 or the 777-200

That alone would just make the traffic show up on your ND or map. But then it's roughly 5 lines of Nasal code to adapt the tanker.nas code to "inject" traffic into our AI system, coming from those MapStructure controllers - i.e. the searchCmd return result would be passed onto the AI system.

It's a hack, but not even an ugly one, and not even difficult - it involves under 50 lines of Nasal code in total, and you'll be able to parse arbitrary traffic feeds, even without fgms.
Technically, it would obviously be better to have one central server, rather than possibly dozens of clients doing that - but this will work,and it's not very much work either.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Populate AI Traffic with real traffic

Postby HJ1AN » Fri May 16, 2014 10:20 am

Hooray wrote in Thu May 15, 2014 10:54 pm:you can still do something like this with less than 50 lines of code - it would just be running locally obviously.


:D

50 lines of code... running it locally... great!

Thanks much for the info, but one small problem.... I have zero understanding of any of that other than the above. :mrgreen: But anyway, it's all great stuff to read through.
User avatar
HJ1AN
 
Posts: 374
Joined: Sat Jul 25, 2009 5:45 am
Callsign: HJ888
Version: 3.4
OS: OS X

Re: Populate AI Traffic with real traffic

Postby Vser » Mon May 19, 2014 10:02 am

Hooray wrote in Thu May 15, 2014 10:54 pm:so you can still do something like this with less than 50 lines of code - it would just be running locally obviously.


By the way, are those 50 lines available somewhere ?

Would it be possible using this solution to update on a rather high frame rate (I guess about 10 hz, interpolation should do the rest) infos such as yaw, pitch and roll of all of the injected AI aircrafts ?
Vser
 
Posts: 8
Joined: Tue May 13, 2014 4:47 pm
Location: Paris, France
Version: 2.0.10
OS: Mint 16

Re: Populate AI Traffic with real traffic

Postby Hooray » Mon May 19, 2014 10:17 am

10 hz ?
you would need to have the data first of all - and unless you have access to some paid data feeds, or live radio feeds, that's where the real problem is
Otherwise, MapStructure itself can sync at frame rate, i.e. 60 fps = 60 hz
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Previous

Return to AI Traffic

Who is online

Users browsing this forum: No registered users and 3 guests