Implementing VNAV support in FlightGear: Difference between revisions

Jump to navigation Jump to search
m
Line 296: Line 296:
JSBSim is entirely built around the [[Property Tree]] concept (actually an outdated version of it - because JSBSim doesn't depend on SimGear, the old property tree code is still used in the source tree), scripting in JSBSim is also implemented on top of the property tree, it isn't really "scripting" per se, it's properties + XML, and some JSBSim specific building blocks to support events, conditions, notifications and some custom expressions like JSBSim functions.  
JSBSim is entirely built around the [[Property Tree]] concept (actually an outdated version of it - because JSBSim doesn't depend on SimGear, the old property tree code is still used in the source tree), scripting in JSBSim is also implemented on top of the property tree, it isn't really "scripting" per se, it's properties + XML, and some JSBSim specific building blocks to support events, conditions, notifications and some custom expressions like JSBSim functions.  


Surprisingly, this rather simple mechanism is pretty powerful, and fully deterministic. To learn more about JSBSim's FGScript itself, you will want to check out the [http://www.holycows.net/JSBSim_Script_Tutorial.pdf JSBSim Scripting Tutorial].
Surprisingly, this rather simple mechanism is pretty powerful, and fully deterministic. To learn more about JSBSim's FGScript itself, you will want to check out the [http://www.holycows.net/JSBSim_Script_Tutorial.pdf JSBSim Scripting Tutorial]. Scripting examples are to be found in the scripts/ directory.


The scripting engine in JSBSim is to be found in src/input_output/FGScript.cpp - scripts are basically just XML files that are evaluated once during initialization, to  set up several data structures (that are later on evaluated in the FGFDMexec() main loop by calling FGScript::RunScript), namely:
The scripting engine in JSBSim is to be found in src/input_output/FGScript.cpp - scripts are basically just XML files that are evaluated once during initialization, to  set up several data structures (that are later on evaluated in the FGFDMexec()::Run by calling FGScript::RunScript), namely:


* initialization stuff (aircraft, initialization file (position, altitude, etc)
* initialization stuff (aircraft, initialization file (position, altitude, etc)
Line 304: Line 304:
* startup parameters (start time/end time and update rate of the simulation)
* startup parameters (start time/end time and update rate of the simulation)
* an arbitrary number of '''<event/>''' blocks
* an arbitrary number of '''<event/>''' blocks
Scripting examples are to be found in the scripts/ directory.


Scripts are loaded via '''bool FGScript::LoadScript()'''
Scripts are loaded via '''bool FGScript::LoadScript()'''

Navigation menu