Nasal HLA standalone: Difference between revisions

Jump to navigation Jump to search
Switch to {{flightgear source}}, {{simgear source}} and {{gitorious source}} to provide functional links.
(Switch to {{flightgear source}}, {{simgear source}} and {{gitorious source}} to provide functional links.)
Line 83: Line 83:
* add the f_setprop/f_getprop code from $FG_SRC/Scripting/NasalSys.cxx to the standalone interpreter {{done}}
* add the f_setprop/f_getprop code from $FG_SRC/Scripting/NasalSys.cxx to the standalone interpreter {{done}}
* add the HLA/OpenRTI boilerplate to the standalone interpreter so that it can use HLA and act as a federate (see $FG_SRC/Network/HLA/hla.cxx and $FG_SRC/utils/fgai) {{progressbar|30}}
* add the HLA/OpenRTI boilerplate to the standalone interpreter so that it can use HLA and act as a federate (see $FG_SRC/Network/HLA/hla.cxx and $FG_SRC/utils/fgai) {{progressbar|30}}
** fgai::AIManager federate: https://gitorious.org/fg/flightgear/blobs/next/utils/fgai/AIManager.hxx#line39
** fgai::AIManager federate: {{flightgear source|path=utils/fgai/AIManager.hxx|line=27}}
** fgviewer: https://gitorious.org/fg/flightgear/blobs/next/utils/fgviewer/fgviewer.cxx#line212
** fgviewer: {{flightgear source|path=utils/fgviewer/fgviewer.cxx|line=212}}
** fgfs: https://gitorious.org/fg/flightgear/blobs/next/src/Network/HLA/hla.cxx#line841
** fgfs: {{flightgear source|path=src/Network/HLA/hla.cxx|line=841}}
** ba-hla: https://github.com/chiemseesurfer/ba-hla
** ba-hla: https://github.com/chiemseesurfer/ba-hla
* next, add a simple "ScriptingHost" federate {{not done}}
* next, add a simple "ScriptingHost" federate {{not done}}
Line 92: Line 92:
* Extend cppbind to support HLA (HLAObjectInstance etc) {{Not done}}
* Extend cppbind to support HLA (HLAObjectInstance etc) {{Not done}}
* port nasal-props.cxx to use cppbind
* port nasal-props.cxx to use cppbind
* maybe support some more FG/Nasal APIs (see https://gitorious.org/fg/flightgear/blobs/next/src/Scripting/NasalSys.cxx#line707 ) {{Not done}}
* maybe support some more FG/Nasal APIs (see {{flightgear source|path=src/Scripting/NasalSys.cxx|line=707}} ) {{Not done}}
** fgcommand()  
** fgcommand()  
** setlistener()
** setlistener()
Line 101: Line 101:
* C++
* C++
* able to build custom SG/FG versions
* able to build custom SG/FG versions
* use gitorious/git
* use git
* have a wiki wiki account  
* have a wiki wiki account  
* work through some of the HLA tutorials at [[FlightGear HLA support (High Level Architecture)#Resources]]
* work through some of the HLA tutorials at [[FlightGear HLA support (High Level Architecture)#Resources]]
Line 127: Line 127:
At some point, the ongoing HLA work should facilitate a scripting API exposed via HLA, so that scripting languages like Nasal (or Python or any other language) would be able to call FG APIs (like extension functions) via HLA
At some point, the ongoing HLA work should facilitate a scripting API exposed via HLA, so that scripting languages like Nasal (or Python or any other language) would be able to call FG APIs (like extension functions) via HLA


Also, there's a standalone interpreter for unit testing: https://gitorious.org/~hooray/fg/hoorays-simgear/commits/nasal-unit-testing
Also, there's a standalone interpreter for unit testing: {{gitorious source|proj=fg|repo=hoorays-simgear}}


So we already do have a standalone Nasal interpreter that cannot currently talk to the fgfs process - making it talk to fgfs through HLA would be a first step, and the setprop/getprop APIs (or whole props module eventually) would be an obvious candidate, because the property tree infrastructure is already in place im simgear/hla (see HLAPropertyDataElement).  
So we already do have a standalone Nasal interpreter that cannot currently talk to the fgfs process - making it talk to fgfs through HLA would be a first step, and the setprop/getprop APIs (or whole props module eventually) would be an obvious candidate, because the property tree infrastructure is already in place im simgear/hla (see HLAPropertyDataElement).  
Line 136: Line 136:


At the time of writing, The SimGear repository already contains all required HLA primitives to map the property tree and other C++ classes to HLA. For example, see:
At the time of writing, The SimGear repository already contains all required HLA primitives to map the property tree and other C++ classes to HLA. For example, see:
* [https://gitorious.org/fg/simgear/blobs/next/simgear/hla/HLAPropertyDataElement.cxx HLAPropertyDataElement.?xx]
* {{simgear source|path=simgear/hla/HLAPropertyDataElement.cxx}}
* [https://gitorious.org/fg/simgear/blobs/next/simgear/hla/HLAObjectClass.cxx HLAObjectClass.?xx]
* {{simgear source|path=simgear/hla/HLAObjectClass.cxx}}
* [https://gitorious.org/fg/simgear/blobs/next/simgear/hla/HLAObjectInstance.cxx HLAObjectInstance.?xx]
* {{simgear source|path=simgear/hla/HLAObjectInstance.cxx}}


Demo code at:  
Demo code at:  
* https://gitorious.org/fg/flightgear/blobs/next/src/Network/HLA/hla.cxx
* {{flightgear source|path=src/Network/HLA/hla.cxx}}
* https://gitorious.org/fg/flightgear/blobs/next/utils/fgai/
* {{flightgear source|path=utils/fgai/}}
 
<syntaxhighlight lang="cpp">
</syntaxhighlight>
 


== HLA support through cppbind ==
== HLA support through cppbind ==
Line 152: Line 148:
In the long run, one would need to implement the full interface of the HLAObjectClass, for example as part of the cppbind framework in simgear/nasal/cppbind- that way, cppbind APIs would become accessible through HLA, so that all cppbind APIs could also be used from a standalone interpreter that would not need to run inside the fgfs main loop anymore.
In the long run, one would need to implement the full interface of the HLAObjectClass, for example as part of the cppbind framework in simgear/nasal/cppbind- that way, cppbind APIs would become accessible through HLA, so that all cppbind APIs could also be used from a standalone interpreter that would not need to run inside the fgfs main loop anymore.


To add HLA support to cppbind, we'd need to provide corresponding [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/cppbind/detail/from_nasal_helper.cxx from_nasal_helper()] and [https://gitorious.org/fg/simgear/blobs/next/simgear/nasal/cppbind/detail/to_nasal_helper.cxx to_nasal_helper()] templates to convert various HLA types to their corresponding Nasal equivalents and vice versa.
To add HLA support to cppbind, we'd need to provide corresponding {{simgear source|path=simgear/nasal/cppbind/detail/from_nasal_helper.cxx|text=from_nasal_helper()}} and {{simgear source|path=simgear/nasal/cppbind/detail/to_nasal_helper.cxx|text=to_nasal_helper()}} templates to convert various HLA types to their corresponding Nasal equivalents and vice versa.


All the SimGear machinery to help with marshalling should be in place in $SG_SRC/hla: https://gitorious.org/fg/simgear/trees/next/simgear/hla
All the SimGear machinery to help with marshalling should be in place in {{simgear source|path=simgear/hla|pre=$SG_SRC}}


Tom can probably help clarify what else may be missing currently ?
Tom can probably help clarify what else may be missing currently ?

Navigation menu