I am trying to control several of FlightGear's internal options via the Generic 
Input protocol, without success. I have been able to create a UDP Listener 
application, setup an "Output block" in the XML protocol file, 
and succesfully read the output string via UDP Socket from FlightGear. Now I 
want to do the opposite and control these items using a Sender application and 
defined input blocks in the protocol XML file. To simplify things I have only 
attempted to write to the Longitude and Latitude position values. 

The following describes code I use in my UDP Sender app, a C# application, the 
protocol XML file, and the command line arguments used to start FlightGear.

First, I developed a simple C# application that initializes a UDP Socket using 
the following bit of code that is called once:

IPEndPoint ipep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 
int.Parse("5500"));
Socket xmlServer = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 
ProtocolType.Udp);
xmlServer.Connect(ipep);

Then a timer function calls the following bit of code every 100 milliseconds:

string templongitude = "-122.357246";
string templatitude = "37.613544";
string desiredDevider = ";";
string tempString = templongitude + desiredDevider + templatitude + "\r";
byte[] data = new byte[1028];
data = Encoding.ASCII.GetBytes(tempString);
xmlServer.Send(data);

The implmentation of these two pieces of code results in the following string 
being sent to port 5500 on 127.0.0.1, every 100 milliseconds:
"-122.357246;37.613544"

I have verified this using my aforemention UDP Listener application.

The following represents the "simpleLongLat_in.xml" file, that is used to 
define the Long/Lat input "chunks":

<?xml version="1.0"?>
<PropertyList>
<generic>
<input>
<line_separator>\r</line_separator>
<var_separator>;</var_separator>
    <chunk>
     <name>Longitude Degree</name>
     <node>/position/longitude-deg</node>
     <type>float</type>
     <format>%f</format>
    </chunk>  
    <chunk>
     <name>Latitude Degree</name>
     <node>/position/latitude-deg</node>
     <type>float</type>
     <format>%f</format> 
    </chunk>  
</input>
</generic>
</PropertyList>

Finally, I begin my application and start broadcasting the data to port 5500, 
on 127.0.0.1, then I open FlightGear with the following options:
 --fdm=null
 --model-hz=100
 --generic=socket,in,100,127.0.0.1,5500,udp,simpleLongLat_in

FlightGear begins, and starts loading, upon reaching the "loading scenery" 
mark, I get a "error reading data." message on the console window, that repeats 
every 100 milliseconds. I've tried various combinations of formatting to the 
XML file and to the outgoing text string without success (such as placing 
"long=%f" in the <format> line of the XML file and the outgoing string). What 
am I doing wrong?

The following represents the PC I'm running this on:
Windows XP OS
Pentium 4 CPU, 2.80GHz
1.0 GB RAM

While not a screaming machine, I can run FlightGear on this platform, without 
major problems.

Thanks,

Brent A. Terwilliger
[EMAIL PROTECTED]


      

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Flightgear-users mailing list
Flightgear-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-users

Reply via email to