Using listeners and signals with Nasal: Difference between revisions

Jump to navigation Jump to search
m
→‎Nasal code coupled to the autopilot system: https://code.google.com/p/flightgear-bugs/issues/detail?id=421#c13
m (→‎Nasal code coupled to the autopilot system: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13029.html)
m (→‎Nasal code coupled to the autopilot system: https://code.google.com/p/flightgear-bugs/issues/detail?id=421#c13)
Line 193: Line 193:


=== Nasal code coupled to the autopilot system ===
=== Nasal code coupled to the autopilot system ===
The FDM doesn't run at a fixed rate, either. It runs 120 times per second (if so configured), but it runs all iterations for a frame one after the other, then waits until the next frame. The FDM runs at 120 hertz and with a fixed time step.
Autopilot rules, FDM and important instruments run at fixed rate of 120Hz and are already _independant_ of frame rate (Note: this does not help those who try to implement APs manually using Nasal, since Nasal can only run at frame rate. But please do use the "autopilot property rule" system for the fast control part of the autopilot - and only do slow stuff in Nasal (such as switching between autopilot modes), which does not require a close coupling to the FDM/autopilot. The 777 is a good example showing this: dynamic part of AP is done by property rules; switching between AP modes, like "hold glideslope" => "flare" is done in Nasal).
 
The FDM runs 120 times per second (if so configured), but it runs all iterations for a frame one after the other, then waits until the next frame. The FDM runs at 120 hertz and with a fixed time step.


However, we play one small trick to make that happen.  We take the time that has elapsed since the last frame, compute how many whole iterations of the
However, we play one small trick to make that happen.  We take the time that has elapsed since the last frame, compute how many whole iterations of the
Line 251: Line 253:
* 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
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13022.html
* https://code.google.com/p/flightgear-bugs/issues/detail?id=421

Navigation menu