Board index FlightGear Support Interfacing

how can I control two aircraft?

Connecting two computers, using generic protocol, connecting with Matlab?

how can I control two aircraft?

Postby fane » Mon Feb 20, 2012 4:45 pm

I launch a flightgear. But the default there is a aircraft. It can be appointed by the parameter "--aircraft",such as "--aircraft=f16".
But I want to place two aircrafts in the same flightgear,such as " A aircraft is f16 and B aircraft is f18". what should I do?
By the way, If I want to control the two aircrafts by network data, it is feasible?
fane
 
Posts: 9
Joined: Mon Feb 20, 2012 4:34 pm

Re: how can I control two aircraft?

Postby fane » Tue Feb 21, 2012 4:51 am

I know that with multiplayer mode, by adding a server, I can do this.
But,it needs more computers.
In a single computer, only a flightergear is running. How to do this?
fane
 
Posts: 9
Joined: Mon Feb 20, 2012 4:34 pm

Re: how can I control two aircraft?

Postby sgofferj » Tue Feb 21, 2012 5:38 am

It's not possible with a single computer with only one FG running. However, you said yourself that you want to control the aircraft via network, so there must be another computer, right?
If you use only 2 computers, you don't need a server for MP. The computers can talk to each other directly.
FG 3.1 GIT / Opensuse 12.3 / Phenom II X4 / GForce GTX560
Stefan's little Flightgear corner | The Finnish Weather Center | Wolves in Finland

Working on: EFTP
COM: IAX2:home.gofferje.net/stefan (MO-FR 0700-2000 UTC, SA+SU 0900-2000 UTC)
sgofferj
 
Posts: 790
Joined: Mon Dec 05, 2011 4:13 pm
Location: EFTP
Callsign: OH-SW
Version: 3.1 GIT
OS: Opensuse

Re: how can I control two aircraft?

Postby Thorsten » Tue Feb 21, 2012 9:17 am

I launch a flightgear. But the default there is a aircraft. how can I control two aircraft?


Flightgear is supposed to be a realistic simulation. Since real pilots also contol one aircraft at a time and neither control two aircraft from the same cockpit nor somehow bilocate to fly two aircraft at once (airlines would be so happy to cut personnel costs in half...), this also doesn't work in Flightgear.

Maybe a better way to proceed would be to actually describe what you want this functionality for? There are AI scenarios for wingmen, there is AI traffic, there is multiplayer,... why don't these features work for you?
Thorsten
 
Posts: 10097
Joined: Mon Nov 02, 2009 8:33 am

Re: how can I control two aircraft?

Postby fane » Tue Feb 21, 2012 12:28 pm

sgofferj wrote in Tue Feb 21, 2012 5:38 am:It's not possible with a single computer with only one FG running. However, you said yourself that you want to control the aircraft via network, so there must be another computer, right?
If you use only 2 computers, you don't need a server for MP. The computers can talk to each other directly.


thanks. In your opinion, the FG can not distinguish two aircrafs?
According to your advice, I want to send some data to "f16",but other data to "f18", how to do this?
fane
 
Posts: 9
Joined: Mon Feb 20, 2012 4:34 pm

Re: how can I control two aircraft?

Postby Gijs » Tue Feb 21, 2012 3:25 pm

You can run two instances of FlightGear on one computer and connect them as described at the wiki (instead of connecting to the multiplayer server you can set the hostname to "localhost").
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9306
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: how can I control two aircraft?

Postby fane » Wed Feb 22, 2012 4:51 am

OK, my mind is as follows:
I ever use vega(vega prime) to simulation. In Vega, you can assign any aircraft in your program. And, the Vega can distinguish them by an unique ID. In running, you can send data to every aircraft by network.
I wonder if FG does this.
fane
 
Posts: 9
Joined: Mon Feb 20, 2012 4:34 pm

Re: how can I control two aircraft?

Postby Torsten » Wed Feb 22, 2012 7:36 am

Simple answer: No, FlightGear does not work this way.
Amplified answer: Currently, there is exactly one FDM controlling exactly one aircraft model in one session of FlightGear.

We have a very clever guy working on integrating HLA into FlightGear. Once that is implemented, the idea is already there to be able to virtually walk along a number of parked aircraft on the apron, click on any of them, enter the cockpit and go for a flight. But that's definitely still a long way to go.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 621
Joined: Fri Feb 01, 2008 9:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

completely offtopic

Postby Hooray » Thu Feb 23, 2012 2:00 pm

It's not all that unrealistic to ask for this, there are many academic projects that could profit from such a capability.
This has also been frequently discussed on the devel list, just see all the pointers and links here: http://wiki.flightgear.org/An_Integrate ... fic_System
The majority of issues pointed out there, links back to long term contributors, if not even core developers.

It would be possible to create a scripted workaround using Nasal, so that you could run several scripted FDMs and switch between different aircraft (i.e. position, orientation, velocities properties), then copying/aliasing the properties for a single cockpit panel.

However, most systems in FlightGear still have some old hard-coded assumptions, such as i.e. "a single aircraft".
The wiki has plenty of pointers to such discussions, i.e. see: http://wiki.flightgear.org/Decoupling_t ... fic_System

So, most core devleopers seem to agree that improving and generalizing the code would be a good thing in the long run, for example see this 8-year old posting which is still relevant today:
http://www.mail-archive.com/flightgear- ... 18446.html
in 2003, Andy Ross (YaSim/Nasal developer) wrote:FlightGear is an old code base, and lots of the old assumptions (like
a single aircraft) need to be teased out of the code before progress
can be made on new features. This kind of work isn't glamorous, and
often requires more effort than the new development does. But it's
not brain surgery either. The problem with some great new features is
that they show up with code that is "ready" to integrate, but without
the integration work done. So they languish in the CVS tree until
everyone forgets about them. I can recall at least one occasion where
a unused module got replaced by a simpler (and arguably less
functional) one precicely because the original never got integrated
very well and the replacement actually worked.


completely off topic:
Thorsten wrote:Flightgear is supposed to be a realistic simulation. Since real pilots also contol one aircraft at a time and neither control two aircraft from the same cockpit nor somehow bilocate to fly two aircraft at once (airlines would be so happy to cut personnel costs in half...), this also doesn't work in Flightgear.


There was once a NASA project, dedicated to enabling airliners to be remotely controlled.

The idea was that pilots could let the autoflight system fly most of the time (until some "event" (i.e. TCAS RA) occurs that requires real pilot interaction), so that under normal circumstances only departures and approaches would be flown by pilots via remote control (i.e. data uplink/downlink). In a way, you'd be multiplexing pilots across several aircraft.

The same method is already used to control UAVs (i.e. military drones) which do fly in the same class C airspace as airliners do.
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: 11267
Joined: Tue Mar 25, 2008 8:40 am

Re: how can I control two aircraft?

Postby Thorsten » Thu Feb 23, 2012 8:49 pm

It's not all that unrealistic to ask for this, there are many academic projects that could profit from such a capability.


Okay, maybe you guys see something I don't, but I simply don't get it.

I'm sitting in front of my laptop which has one screen on which I see one cockpit. I have one main input device (my mouse) and my keyboard.

Now, I could just possibly imagine plugging in a second screen and getting to see a second cockpit. I can just barely imagine plugging in a second mouse to control things in this second cockpit. But what is beyond my comprehension is why I would want to do that - that'd be terribly confusing. And what is way, way beyond my comprehension is why I would want to do it without using a network and the multiplayer protocol.

But apparently it's only me... so please just ignore me.
Thorsten
 
Posts: 10097
Joined: Mon Nov 02, 2009 8:33 am

Re: how can I control two aircraft?

Postby Hooray » Sun Feb 26, 2012 12:21 pm

Actually, I do agree with your perspective - but, for example, there are many scenarios and situations where support for multiple FDM instances would be really useful.

Just think about the AI traffic system which has meanwhile come up with its own "pseudo FDM" in C++ space, i.e. using a performance database.

At the moment, AI traffic will be basically agnostic to anything weather related. Think about turbulences etc - But, it would be possible to actually instantiate a separate FDM process/thread and use it to control AI traffic realistically, so that local weather effects would have an impact on AI traffic, too.

The wiki has plenty of pointers to discussions where people actually came up with good ideas on how to implement this.
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: 11267
Joined: Tue Mar 25, 2008 8:40 am

Re: how can I control two aircraft?

Postby Thorsten » Mon Feb 27, 2012 11:02 am

At the moment, AI traffic will be basically agnostic to anything weather related. Think about turbulences etc - But, it would be possible to actually instantiate a separate FDM process/thread and use it to control AI traffic realistically, so that local weather effects would have an impact on AI traffic, too.


Well, think it through - the difference is the same as between local light and the lightfields.

Local Weather provides weather at your location. Implicitly, it knows weather at any other location, i.e. if you would go to any other location, it could tell you what the weather is - but you're limited to one location per frame. But what you need for AI traffic is explicit information, the weather field, i.e. the ability to provide weather for any number of locations in the scene - and that's a rather different beast. Not conceptually, but as far as performance goes.

Right now I know there's at most one single thermal active at any given time. It'd be much more complex to allow for an arbitrary number, or to compute the real wind for any wind turbine in the scene, or the real turbulence for any AI aircraft in the scene. So you'd have to in fact spend far more brainpower and performance than 'just' creating another instance of an FDM to make it realistic.

Btw, the question wasn't 'How do I get a second FDM instance for AI planes?', it was 'How do I control two aircraft?' and for me these are distinct questions.
Thorsten
 
Posts: 10097
Joined: Mon Nov 02, 2009 8:33 am

Re: how can I control two aircraft?

Postby Hooray » Mon Feb 27, 2012 11:15 am

Thorsten wrote in Mon Feb 27, 2012 11:02 am:Btw, the question wasn't 'How do I get a second FDM instance for AI planes?', it was 'How do I control two aircraft?' and for me these are distinct questions.


Yes, but supporting more than a single FDM instance would obviously be required, which is probably why Torsten replied in a similar fashion:

Torsten wrote:Simple answer: No, FlightGear does not work this way.
Amplified answer: Currently, there is exactly one FDM controlling exactly one aircraft model in one session of FlightGear.
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: 11267
Joined: Tue Mar 25, 2008 8:40 am

Re: how can I control two aircraft?

Postby leonardo_Araujo » Fri Jul 08, 2016 2:18 pm

I would like to share here an idea and make a kind of brainstorm:

Supposing that we think in AI model as a 3D body with a set of propreties, and then, once we already know how to send informations via UDP port from "Matlab-Simulink" to our Flightgear instance (with the purpose to create our own virtual "FDM" running outside flightgear), why not send additional information via this same port or another to modify the properties of our AI model such as latitude, aoa, engine power and so on?
we have two external FDM acting as source of information for controlling two models, one is a properly said aircraft and other is AI model that could be a missile or an aircraft.
leonardo_Araujo
 
Posts: 2
Joined: Tue Jun 21, 2016 4:39 pm


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 0 guests