Implementing VNAV support in FlightGear: Difference between revisions

Jump to navigation Jump to search
m
Line 232: Line 232:
=== I/O ===
=== I/O ===
For more sophisticated I/O needs, there's a separate folder in '''src/input_output/''', which contains various examples on implementing  '''FGOutput''' based I/O protocols. This is also the place where the FG interfacing machinery is to be found, specifically see FGOutputFG.cxx.
For more sophisticated I/O needs, there's a separate folder in '''src/input_output/''', which contains various examples on implementing  '''FGOutput''' based I/O protocols. This is also the place where the FG interfacing machinery is to be found, specifically see FGOutputFG.cxx.
To make use of the FlightGear interface, you need to edit your JSBSim/FDM xml file and add an output section to the toplevel '''fdm_config''' node:
<syntaxhighlight lang="xml">
<output name="localhost" type="FLIGHTGEAR" port="5600" rate="60" protocol="UDP"/>
</syntaxhighlight>
This tells JSBSim to use port 5600 (via UDP) at a rate of 60 hz to send FDM updates to the corresponding FlightGear instance.
Next, to slave FlightGear to JSBSim in standalone mode via port 5600, you would use these additional parameters:
<syntaxhighlight lang="text">
--fdm=null --native-fdm=socket,in,60,,5600,udp
</syntaxhighlight>
(Type of aircraft doesn't really matter, the FDM output will be applied to any model, no matter if it's a 747, the ufo or the ogeL).
After making these changes, and after starting FlightGear, it's time for starting JSBSim, too:
<syntaxhighlight lang="text">
JSBSim  --root=$HOME/sources/jsbsim-code/ --aircraft=c310 --initfile=ellington
</syntaxhighlight>
Typically, you'll however want to use FGScript to create a completely script JSBSim run.
Obviously, it would also make sense to directly start up FlightGear at a location close to your initial FDM settings.


=== Adding new Functions ===
=== Adding new Functions ===

Navigation menu