April 3, 200620 yr hi, thx for your care first.I want to handle the Input/Output option in FG, cuz i should the datum from FG(while flying, there may be bunch of dynamic parameters for example velocity, altitude, heading angle, pitch angle and on...)i want to make a UDP socket server program which link to FG and get datum from FG...but i don't have any information that how FG work as a client.And there is no place that i can insert the server IP in FG.Is there any detailed document about it?I am using WindowXP and C++ complier
April 3, 200620 yr >I want to handle the Input/Output option in FG, cuz i should>the datum from FG(while flying, there may be bunch of dynamic>parameters for example velocity, altitude, heading angle,>pitch angle and on...)Have you checked out the documentation under $FG_ROOT/Docs ?>i want to make a UDP socket server program which link to FG>and get datum from FG...but i don't have any information that>how FG work as a client.Check out README.IO & README.protocol under $FG_ROOT/Docs>And there is no place that i can insert the server IP in FG.Host addresses are specified using command line parameters, check out fgfs --help --verbose>Is there any detailed document about it?>I am using WindowXP and C++ complierYou should first check out the available documentation under $FG_ROOT/Docs.The mentioned files are plain text files, and as such can be easily openend with any text editor.However, your questions are development specific, and as such are better dealt with on the FlightGear devel mailing list: http://www.flightgear.org/mail.htmlAlso, you may find the following forum discussions helpful:http://forums.avsim.net/dcboard.php?az=sho...d=842&mode=fullhttp://forums.avsim.net/dcboard.php?az=sho...=1086&mode=fullhttp://forums.avsim.net/dcboard.php?az=sho...=1411&mode=full
May 3, 200620 yr Hi, I am developing an external helicopter FDM in python for a college final project, which i hopefully think someday will let me open source. Until then this is the information I gathered:If you want FlightGear to send out information:--native-ctrls=socket,out,HZ,YOURPROGRAMIP,YOURPROGRAMPORT,udpWhere you must substitute options in capital letters with the correct values.The protocol is very simple, and is described in src/Network/net_ctrls.hxx, you will see a class named FGNetCtrls. At each cycle FG fills the values of this class using FGProps2NetCtrls (src/Network/native_ctrls.[h,c]xx) and sends the class via sockets as its stored in memory.If you are programming in C/C++ you are lucky: you just need to make a mirror class in your program and copy the contents. If you are not using C/C++, like me, be careful of the padding (for example double values always get aligned at multiples of 8 bytes, at least on my AMD X2). To be sure you should compile FG with debugging flags and have a look at the memory with gdb.BTW, don't take me too seriously on this but in this case I think it's FG acting as the server, not the client.I think this already answers you question. I will post some other things just to be sure:Similarly FG accepts FDM state:--native-fdm=socket,in,HZ,FGIP,FGPORT,udp Have a look at FGNetFDM in src/Network/net_fdm.hxx.Finally, if you want to have both input and output from flightgear there is an (I think) undocumented option, which is the one I'm using:--fdm=network,localhost,5001,5002,5003,Where 5001: ctrls port, 5002: FDM port, 5003: commands portBtw, notice the final comma, I think is a bug in the way FG parses this option, if you don't pass the final comma FG will ignore this last port.The commands protocol is described in HTTPClient in src/FDM/ExternalNet/ExternalNet.hxxHope this helps, maybe someday I will write a tutorial :)
Create an account or sign in to comment