Board index FlightGear Support Interfacing

External FDM Problems: Multiple Aircraft

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

External FDM Problems: Multiple Aircraft

Postby Chris23456 » Tue Aug 12, 2014 5:15 pm

Hi Everyone,

I've been using Flightgear to visualize my simulations. I'm currently busy with my masters and it involves control system design for a helicopter landing on a ship deck. In order to visualize this, I run two instances of flightgear and connect them using multiplayer. I run my simulations on a separate computer and stream the data over via the network. For clarity sake, I must say that I want, and need both visualizations to run on one computer (in two instances of flightgear). This is mostly due to the larger jitter problems when running multiplayer over the network.

I have models for both the ship and the helicopter running in MATLAB and I'm able to interface quite easily with the visualization via an sfunction that I wrote. The issue that I'm having is that FlightGear won't seem to bind to any other port than 5502 for an FDM input and, for the life of me, I can't figure out why (resulting in an inability to stream data for both visualizations simultaneously). I've established that its not my sfunction (via a udp test) and I've narrowed it down to either a bug in flightgear or something wrong with my setup scripts. I'm running FlightGear 3.0, but was originally running 2.10 (I upgraded to try fix this, but that didn't help).

The setup scripts that I use are shown below,

Helicopter:
Code: Select all
start /D "C:\Program Files\FlightGear\bin\Win32\" /MAX fgfs.exe --fg-root="C:\Program Files\FlightGear\data" --units-meters --aircraft=simheli --time-match-local --httpd=5801 --fdm=network,<hostpcip>,5502 --multiplay=out,10,localhost,5504 --multiplay=in,10,localhost,5503 --callsign=heli

Ship:
Code: Select all
start /D "C:\Program Files\FlightGear\bin\Win32\" /MAX fgfs.exe --fg-root="C:\Program Files\FlightGear\data" --units-meters --aircraft=corvette --time-match-local --httpd=5804 --fdm=network,<hostpcip>,5501 --multiplay=out,10,localhost,5503 --multiplay=in,10,localhost,5504 --callsign=corvette


Flightgear will only work if I use port 5502. Is this standard behavior, or am I missing something? The only other relevant information I can think of is that I use custom models, but I tested it with a different aircraft model and found no difference.

Thanks in advance!

Chris
Chris23456
 
Posts: 2
Joined: Tue Aug 12, 2014 2:29 pm

Re: External FDM Problems: Multiple Aircraft

Postby Chris23456 » Wed Aug 13, 2014 6:53 pm

Ok, so I found the problem. It seems trivial, but it took quite a while to figure out. Turns out that the command line parameter
Code: Select all
--fdm=network,<hostip>,5500
is incorrect syntax, and somehow it defaults to port 5502 regardless of what port number is specified.

It would seem then, that the fix is to replace this with,
Code: Select all
--fdm=network,10,<hostip>,5500
which now works. I presume that 10 is the packet frequency.

Hope this saves somebody else the headache.

Chris
Chris23456
 
Posts: 2
Joined: Tue Aug 12, 2014 2:29 pm

Re: External FDM Problems: Multiple Aircraft

Postby Hooray » Wed Aug 13, 2014 8:23 pm

Hi & welcome,

yes, the format can be seen in $FG_ROOT/DOCS/README.IO - the format is pretty much standard for all FlightGear I/O protocols, unless there's some special "short-hand" syntax support (e.g. telnet/props).
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


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 2 guests