Using listeners and signals with Nasal: Difference between revisions

Jump to navigation Jump to search
m
Update forum links
m (Update forum links)
Line 218: Line 218:


Another possibility is to extend the declarative expression logic, which is already supported by the autopilot components, to allow a Nasal expression. Then you mix the declarative components (which you're going to want for most autopilot laws) with some scripted ones.
Another possibility is to extend the declarative expression logic, which is already supported by the autopilot components, to allow a Nasal expression. Then you mix the declarative components (which you're going to want for most autopilot laws) with some scripted ones.
Since the expression evaluation would be driven by the autopilot subsystem, it would run at whatever frame-rate that itself runs at - which is currently in lock-step with the FDM [http://flightgear.org/forums/viewtopic.php?f=46&t=17069&hilit=nasal+fdm+autopilot&start=15#p165596].
Since the expression evaluation would be driven by the autopilot subsystem, it would run at whatever frame-rate that itself runs at - which is currently in lock-step with the FDM [http://forum.flightgear.org/viewtopic.php?f=46&t=17069&hilit=nasal+fdm+autopilot&start=15#p165596].


There are several other 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 are several other 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:
Line 231: Line 231:
Some core developers are fairly opposed to the whole idea, i.e. want to avoid *any* Nasal in the fast simulation loop of the FDM, because Nasal execution is slow and non-deterministic because of its GC issue. Running it in the fast simulation loop is the last thing they want[http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38172.html].
Some core developers are fairly opposed to the whole idea, i.e. want to avoid *any* Nasal in the fast simulation loop of the FDM, because Nasal execution is slow and non-deterministic because of its GC issue. Running it in the fast simulation loop is the last thing they want[http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg38172.html].


In addition, the developer and maintainer of the AP system is planning on adding Nasal bindings to the AP code to allow runtime instantiation of ap/property rules and has a Nasal binding for that in mind[http://flightgear.org/forums/viewtopic.php?f=66&t=15189&p=149376&hilit=#p149376].  
In addition, the developer and maintainer of the AP system is planning on adding Nasal bindings to the AP code to allow runtime instantiation of ap/property rules and has a Nasal binding for that in mind[http://forum.flightgear.org/viewtopic.php?f=66&t=15189&p=149376&hilit=#p149376].  


You can then use Nasal for the high level stuff, and enable/disable/switch the individual controller elements (e.g. in order to automatically switch the autopilot mode when capturing the ILS). There are some nice examples with fgdata/Git aircraft. You could look at the 777.
You can then use Nasal for the high level stuff, and enable/disable/switch the individual controller elements (e.g. in order to automatically switch the autopilot mode when capturing the ILS). There are some nice examples with fgdata/Git aircraft. You could look at the 777.
Line 259: Line 259:


Also see:
Also see:
* http://flightgear.org/forums/viewtopic.php?f=66&t=15189&p=149376&#p149376
* http://forum.flightgear.org/viewtopic.php?f=66&t=15189&p=149376&#p149376
* http://flightgear.org/forums/viewtopic.php?f=46&t=17069
* http://forum.flightgear.org/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
* http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg13022.html
* https://code.google.com/p/flightgear-bugs/issues/detail?id=421
* https://code.google.com/p/flightgear-bugs/issues/detail?id=421

Navigation menu