20,741
edits
m (→Nasal code coupled to the autopilot system: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38170.html) |
|||
Line 198: | Line 198: | ||
Some FDM stuff would like to be tied to the FDM update rate, and that's a desirable goal. What about a callback function then? The FDM subsystem would set /sim/signals/fdm-update, and you could attach a listener to that which does all the things that should interact with the FDM, such as AP, FCS, etc. The rest of Nasal would keep running with the frame rate. | Some FDM stuff would like to be tied to the FDM update rate, and that's a desirable goal. What about a callback function then? The FDM subsystem would set /sim/signals/fdm-update, and you could attach a listener to that which does all the things that should interact with the FDM, such as AP, FCS, etc. The rest of Nasal would keep running with the frame rate. | ||
There are several options, such as 1) Run a second events system and add an additional parameter to Nasal's settimer allowing you to use this new events system. 2) Add in a signal that is fired each simulation step, probably right before the Autopilot system is run. | There's just one (minor) problem at the moment. There's no generic FDM update() function where one could put a sig.setDoubleValue(dt).This would have to be done in all FDMs. | ||
There are several options, such as 1) Run a second events system and add an additional parameter to Nasal's settimer allowing you to use this new events system. 2) Add in a signal that is fired each simulation step, probably right before the Autopilot system is run: | |||
<syntaxhighlight lang="php"> | |||
setlistener("/sim/signals/fdm-update", func(n) { | |||
var dt = n.getValue(); | |||
# ... and whatever needs to be done at fdm rate | |||
}); | |||
</syntaxhighlight> | |||
Also see: | Also see: | ||
* http://flightgear.org/forums/viewtopic.php?f=46&t=17069 | * http://flightgear.org/forums/viewtopic.php?f=46&t=17069 | ||
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38170.html | * http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38170.html | ||
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13022.html |