Board index FlightGear Development

Multiple intelligent flyers

FlightGear is opensource, so you can be the developer. In the need for help on anything? We are here to help you.
Forum rules
Core development is discussed on the official FlightGear-Devel development mailing list.

Bugs can be reported in the bug tracker.

Multiple intelligent flyers

Postby espais » Tue Jan 03, 2012 11:02 pm

Hi everybody,

I am quite, quite new to FlightGear and have some questions. In a nutshell, I'm doing some academic research and am considering using FlightGear / JSBSim in order to get some work done.
I am curious about some of the following...please let me know if I'm attacking this from the wrong direction or going way off base :D.

What I would like to do is model some very simple flyers (basically microcopters, but with less emphasis on airframe/aerodynamics and more on simply controlling them), and then have some algorithms running that would control the flyers independently. Basically I want to create a swarm of flying robots and be able to play with how they are controlled.

From my understanding of the guides/wiki and so on, the aircraft are modeled via XML files. I currently have some basic 3D models of my flyers done up in SolidWorks, and it seems that I can figure out a way to export them into the FlightGear model type. Since the craft are very basic I imagine it won't be too hard to model them.

What I would like to know is if FlightGear could support multiple aircraft in a single instance (not a multiplayer server...I'd like to just spawn a bunch of these things), and also each having their own independent brain which I would provide functionality for, based on the output of the algorithms that I run.

Also, is it possible that any sort of sensing equipment is implemented here as well? I'd kind of like to give them a target and tell them to simply "go to that" as well.
espais
 
Posts: 2
Joined: Tue Jan 03, 2012 9:57 pm

Re: Multiple intelligent flyers

Postby Hooray » Tue Jan 03, 2012 11:12 pm

What I would like to know is if FlightGear could support multiple aircraft in a single instance (not a multiplayer server...I'd like to just spawn a bunch of these things), and also each having their own independent brain which I would provide functionality for, based on the output of the algorithms that I run.


For something like this, the simplest solution is probably using scripted AI traffic nodes. Note however that AI traffic cannot currently make use of any FDMs (JSBSim/YaSim), instead you need to come up with your own "pseudo FDM" in scripting space.

You might be able to circumvent this restriction by coming up with a separate FDM and communicating with FG using sockets.

We have a number of more or less complex examples for this. $FG_ROOT/Nasal/tanker.nas is the simplest test case you'll find, which basically spawns an "AI tanker" that can be used for refueling purposes. It would be possible to generalize the script some more in order to spawn an arbitrary number of aircraft. Also, you could equip them with a scripted control loop, so that each node can be controlled individually, i.e. by either setting a bunch of properties, or even by issuing ATC instructions.

Curt has recently provided a more complex example.
The most complex example for this technique is certainly the "bombable addon" which implements "AI bots" entirely in scripting space to provide "dog fighting" support.

I would suggest to search the archives (wiki, forum, mailing list) and look into the aforementioned examples.

Also, you'll inevitably need to look into the Nasal documentation, too: http://wiki.flightgear.org/Nasal_scripting_language

You may also be interested in this:
viewtopic.php?f=23&t=7791#p75820
viewtopic.php?f=23&t=5900
http://www.flightgear.org/forums/viewto ... 0&p=142081
viewtopic.php?f=30&t=10223
viewtopic.php?f=30&t=9033&p=90071&#p89374

Also, is it possible that any sort of sensing equipment is implemented here as well? I'd kind of like to give them a target and tell them to simply "go to that" as well.

viewtopic.php?f=36&t=212
viewtopic.php?f=36&t=7640
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: Multiple intelligent flyers

Postby espais » Wed Jan 04, 2012 4:31 pm

I'll have to go through all that info...thanks! :D
espais
 
Posts: 2
Joined: Tue Jan 03, 2012 9:57 pm

Re: Multiple intelligent flyers

Postby Hooray » Wed Jan 04, 2012 4:55 pm

make sure to also do a forum/mailing list search for "tanker.nas".

Most of these pointers should be added here eventually: http://wiki.flightgear.org/Spawning_and ... s_in_Nasal

If you want to document your work, please use our wiki (the link above should be fine) - I'll be there to answer any questions you may have, if you agree to add your findings to the wiki. This is something that is currently not too well documented, although we do have a handful of examples.

So, it'd be great to have someone interested in looking into this, learning the details and documenting the whole process for others.

We are here to provide the required pointers and answers.
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: Multiple intelligent flyers

Postby Hooray » Thu Jan 05, 2012 6:21 pm

EDIT: EDIT: Streaming, screen-grabbing and computer vision/openCV, see: http://wiki.flightgear.org/Canvas_Devel ... ter_Vision
espais wrote in Tue Jan 03, 2012 11:02 pm:Also, is it possible that any sort of sensing equipment is implemented here as well? I'd kind of like to give them a target and tell them to simply "go to that" as well.


I think, I misunderstood, I just read "sensing" and posted the OpenCV-related links.
But, if you are just looking for a way to give your "AI bots" certain targets, then you can certainly do that already. That's how the tanker example works already.

Also, there's an extremely powerful and flexible autopilot system in FG that is entirely XML configurable: http://wiki.flightgear.org/Autopilot
There's also a very powerful route manager.

Please note however, that there's currently no support for AI traffic to directly make use of the autopilot system or the route manager, so you need to come up with your own infrastructure in scripting space.

Also, at the moment, you cannot easily access the navigation db, but there are some patches available to change that: http://flightgear.org/forums/viewtopic. ... 15#p143184

The AI traffic system has its own "route manager" system which is currently not yet compatible with the rest of FG unfortunately. But there are plans in place to fix this eventually: http://flightgear.org/forums/viewtopic. ... 0&#p134970

If you know C++ and if you are able to build FG from source, you might want to look into dynamically instantiating autopilots and allowing the route manager to have multiple instances, too. This would basically allow you to have several instances of route managers and autopilots and use them to control your AI aircraft.

So you could have a top level Nasal script sending commands to a route manager instance that is specific to certain AI aircraft. This would allow you to have pretty complex traffic scenarios, even with realistically interacting traffic, and you could even have an ATC script that works with such scenarios

Basically, you would need to hack the autopilot code so that autopilot configurations can be loaded and created dynamically. At the moment, the autopilot code makes the fixed assumption that there's only a single "main aircraft", so it doesn't know about more than one aircraft.

This can be accomplished by implementing the SGPropertyChangeListener interface. This is, for example, how the AI traffic system works: it is watching a dedicated node in the property tree for "events" and then analyses the sub tree and then creates traffic dynamically.
So if you wanted to equip your AI traffic with a working route manager, autopilot or even FDM, you would also need to instantiate these subsystems dynamically (for each node): http://simgear.sourceforge.net/doxygen/ ... tener.html
Last edited by Hooray on Thu May 15, 2014 5:15 pm, edited 1 time in total.
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: Multiple intelligent flyers

Postby Bomber » Thu Jan 05, 2012 7:15 pm

Hi,

Some of the limitations that hooray has posted are unaceptable to T4T, so we'd be looking to create extra code for AI intelligence for formation flying, convoy routing etc.

If you'd care to contact Paul at simulab I'm sure we could help each other, reducing the workload.

Regards

Simon.
"If anyone ever tells you anything about an aeroplane which is so bloody complicated you can't understand it, take it from me - it's all balls" - R J Mitchel
Bomber
 
Posts: 1933
Joined: Fri Dec 14, 2007 8:06 pm
OS: Windows XP and 10


Return to Development

Who is online

Users browsing this forum: No registered users and 12 guests