Board index FlightGear Development Documentation

Flightgear experiment

Discussion of the FlightGear documentation, how it can be improved and coordination of people working on it.

Flightgear experiment

Postby jonititan » Fri Nov 24, 2017 3:10 pm

So I used flightgear in a successful experiment to display real aircraft data to some pilots and get their feedback. I will be writing it up for publication but here is the most useful nasal bit.
I inserted the following code into acconfig.nas
First I created a list of all the properties (called "experiment_props") which I wanted to be able to switch the webpanels I had created from reading from the flightgear FDM to reading from my data.
This was done as it meant my webpanels could watch properties I could guarantee weren't being used by a flightgear process for anything.

Then it was just a matter of unaliasing the new properties when I wanted to start feeding my data to the pilots panels.
I did contemplate making it robust enough to switch it on and off but decided not to fiddle with it for the time being.

Code: Select all
setprop("/systems/acconfig/autostart-taxi", 0);
setlistener("/systems/acconfig/autostart-taxi", func {
   if (getprop("/systems/acconfig/autostart-taxi") == 1 ) {
      taxi();
      setprop("/systems/acconfig/panel-load-completed", 1);
      var experiments_props = experiments_props;
            foreach(var lentry; experiments_props){
                  var experiment_tmp = string.join("",["/experiment",lentry]);
                  var tmp_node = props.globals.initNode(experiment_tmp).alias(lentry);

               };
setlistener("/systems/acconfig/override-begin", func {
   if (getprop("/systems/acconfig/override-begin") ==1) {
         setprop("/systems/acconfig/override-message-ack",1);
         var experiments_props = experiments_props;
         foreach(var lentry; experiments_props){
         var experiment_tmp = string.join("",["/experiment",lentry]);
         var tmp_node = props.globals.getNode(experiment_tmp).unalias(lentry);
         var tmp_val = getprop(lentry);
         setprop(experiment_tmp,tmp_val);
         };
      };

});
   }
});
Joni P
Flight Data guy.
Ask me about artificial immune systems for health management of unmanned aircraft...
jonititan
 
Posts: 15
Joined: Fri Sep 29, 2017 2:04 pm

Return to Documentation

Who is online

Users browsing this forum: No registered users and 0 guests