It was asked in the German fgfs forum[1] if it's possible
to log internal data to an XML file. Sure is! :-)
The attached file put into $FG_ROOT/Nasal/ starts logging
to /tmp/data.xml as soon as the FDM is up (one data set per
second) and stops when fgfs is closed. Because the 1 second
interval isn't guaranteed to be exact, the fgfs runtime
is also saved per data set. As you can see, the script is
very easy to extend and customize.
m.
[1] http://www.flight-gear.de/smf/
var path = "/tmp/data.xml";
var interval = 1.0; # once every second
var format = "\t<set>
\t\t<time>%.5f</time>
\t\t<altitude-m>%.5f</altitude-m>
\t\t<airspeed-kt>%.5f</airspeed-kt>
\t\t<roll-deg>%.5f</roll-deg>
\t</set>
";
var loop = func {
var time = getprop("/sim/time/elapsed-sec");
var alt = getprop("/position/altitude-ft") * geo.FT2M;
var spd = getprop("/velocities/airspeed-kt");
var roll = getprop("/orientation/roll-deg");
io.write(file, sprintf(format, time, alt, spd, roll));
settimer(loop, interval);
}
var file = nil;
_setlistener("/sim/signals/fdm-initialized", func {
file = io.open(path, "w");
io.write(file, "<?xml version=\"1.0\"?>\n\n<data>\n");
setlistener("/sim/signals/exit", func {
io.write(file, "</data>\n");
io.close(file);
});
loop();
});
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel