Jsbsim Tutorial -
Open a terminal and run:
<flight_control name="C172 FCS"> <channel name="Pitch"> <summer name="Pitch Sum"> <input>fcs/elevator-cmd-norm</input> <!-- From joystick --> <input>fcs/pitch-trim-cmd-norm</input> <!-- Trim --> <clipto> -1 1 </clipto> </summer> <pure_gain name="Elevator Gain" gain="1.0"> <input>fcs/pitch-sum</input> <output>fcs/elevator-pos-rad</output> </pure_gain> </channel> </flight_control> The output fcs/elevator-pos-rad is then fed into the aerodynamic table for Cm (pitch moment). You don't just launch the aircraft; you launch a script . A script is an XML file that sets initial conditions and defines maneuvers. jsbsim tutorial
Run it:
Create my_first_flight.xml :
while (fdm.Run()) { double lat = fdm.GetProperty("position/lat-deg"); double lon = fdm.GetProperty("position/lon-deg"); double roll = fdm.GetProperty("attitude/roll-rad"); // Send these to your OpenGL/Unreal engine } return 0; } JSBSim exposes a property tree via Socket or HTTP . Enable the socket server in your script: Run it: Create my_first_flight
JSBSim --script=scripts/c1721.xml You will see a cascade of text output: unit conversions, aerodynamic coefficients, and finally, time-step data every 0.01 seconds. You just ran a simulation. The aircraft took off, climbed, and flew a pattern. You didn't see it, but you simulated it. To control it manually via keyboard/joystick in real-time: The aircraft took off, climbed, and flew a pattern
Originally developed by Jon S. Berndt and now maintained by the open-source community (used extensively by FlightGear and others), JSBSim is written in C++ but configured entirely via XML. This means you can design, tweak, and test a realistic aircraft’s behavior without recompiling a single line of code.