Using listeners and signals with Nasal: Difference between revisions

Jump to navigation Jump to search
m
→‎Nasal code coupled to the autopilot system: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38170.html
m (→‎Signals: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13022.html)
m (→‎Nasal code coupled to the autopilot system: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38170.html)
Line 193: Line 193:


=== Nasal code coupled to the autopilot system ===
=== Nasal code coupled to the autopilot system ===
Some people have a need to run Nasal code at the same rate as the simulation. Currently, without modifying the source code for FlightGear, the only way
to do this is to find a property updated at the right time in the simulation cycle and set a listener on it. From a code quality standpoint, this is less than ideal.
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.
Also see:
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38170.html

Navigation menu