Implementing VNAV support in FlightGear: Difference between revisions

Jump to navigation Jump to search
Line 484: Line 484:


=== Parent & Child FDMs ===
=== Parent & Child FDMs ===
The whole VNAV effort would be simplified if we could directly instantiate the FDM recursively, i.e. run an independent instance of the FDM as part of the FCS, to solve for specific pitch/thrust settings. And it turns out, this is another long-standing idea/feature request, i.e. supporting recursion in FDMs and multiple instances:
The whole VNAV effort would be simplified if we could directly run and query the FDM for some future point in time. This isn't directly supported by JSBSim. However, as a workaround, we could run a "simulation inside the simulation" by instantiating the JSBSim FDM recursively:
 
As in, run an independent instance of the FDM as part of the FCS, to solve for specific pitch/thrust settings.  
 
And as it turns out, this is another long-standing idea/feature request, i.e. supporting recursion in FDMs and having multiple instances per process.
 
Meanwhile, since around ~2009, this has been partially implemented in JSBSim, which now contains support for a '''<child>''' FDM element that is mated/coupled to the main FDM. The feature is still considered experimental and unsupported by JSBSim developers, it is also currently disabled by default - especially in FlightGear, where it's causing problems/segfaults. However, we can look at the corresponding code in order to learn how to instantiate an '''FGFDMExec''' instance as part of '''FCS''' system/channel in order to run an identical FDM instance in look-ahead mode, see $JSBSIM_SRC/FGFDMExec.cpp: '''bool FGFDMExec::ReadChild(Element* el)'''


{{cquote|One feature in JSBSim that I began and have not yet finished (pending other things) is a parent/child capability. You can (for instance) load a Mk82 on
{{cquote|One feature in JSBSim that I began and have not yet finished (pending other things) is a parent/child capability. You can (for instance) load a Mk82 on

Navigation menu