JSBSim Flight Dynamics

There has been some talk about how to do flight simulators or other simulations. Well, here is my contribution.

While others implement simplified, self-written flight dynamics I have chosen to go for as much realism as possible. By using JSBSim Flight Dynamics. This comes at a prize though: more realism means that it is more difficult to fly the plane (anyone has a pilot license? not me). So my choice is probably not the best one for making an easy-to-use shooter game.

Demo (Windows binaries):
http://www.dachau.net/users/pfrogner/JSBSim-Demo.zip (786kb)

Screenshot:
http://www.dachau.net/users/pfrogner/JSBSim-Screenshot.jpg (54kb)

Source code will follow as soon as I have figured out some legal issue. I had to make minimal modifications to the JSBSim source code, and now I have several option: release only my extension source with explanations on how to modify the JSBSim source, release my extension together with the modified source, or provide a download for the compiled static JSBSim libs.

The extension wraps most of the JSBSim API. But the demo utilizes only a small fraction of the functions. This is because the demo is intended to be just a proof of concept, and not full-featured flight simulator.

Usage instructions:

(1) Modify lines 30 and 31 of this script to change display size to whatever
you prefer. Default is 800x600 window mode.
(2) Run “ppython.exe demo.py” to start the demo.
(3) Press “e”. This will do the following things: set magnetos to “both”,
fuel mixture to 87 %, flaps to 32 %, throttle to 25 % and finally start
the engine.
(4) Press Page-Up until throttle is at 100 %. (Page-Up/Down controls the
throttle.
(5) Wait until the plane accelerates and finally takes off at around
110 fps. You don’t need to pull the joystick or do anything else. The
plane will take off all alone.
(6) At about 50 ft altitude press “f” to remove the flaps and reduce mixture
to 69 %.
(7) Use the joystick to steer the plane. Joystick axis 1 controls the
aileron, axis 2 controls the elevator and axis 4 controls the rudder.
(8) Have fun.

Compass code and texture stolen from Hypno’s Jungle engine (https://discourse.panda3d.org/viewtopic.php?t=2648).

What is missing for a full-featured flight simulator:
(1) Use more input key(buttons to control flaps, brakes, trim, …
(2) 2D/3D instrument panel with artificial horizon, altimeter, directional gyro, tachometer, turn coordinator, fuel gauge, …
(3) Implement a paging terrain system. Hint: JSBSim uses earth-centric coordinates for the simulation
(4) Write a game/simulation management, e.g. let the use choose between different airplanes, weather/light conditions, airports, …

enn0x

impressive as always… Good work.

Very nice, thanks for sharing and keep up the good work!

Hello again,

all downloads and links from above will no longer work. I have moved this extension to sourceforge. The official project name is “JSBSim Python Bindings”. The web page is:

–> http://jsbsim-python.sourceforge.net

Besides the Panda3D demo you will find there

  • the source code
  • binaries for Python 2.4 and 2.5 (Windows)
  • precompiled JSBSim libraries

I have exchanged a few mails with Jon Berndt, the maintainer of the C++ JSBSim code, and he told me that the Python extension and the Panda3D demo will be mentioned in the next JSBSim newsletter. Might be this draws some additional attention to Panda3D.

enn0x

cool project “headquarters”. Keep up the good work.

good news
GREAT MOVE !

New release (0.2), available at the SourceForge project site.

Changes:

  • Docstrings added, where available.
  • Subclasses of FGEngine wrapped (Electric, Piston, Rocket!!!, Turbine, TurboProp).
  • Subclasses of FGThruster wrapped (Nozzle, Propeller).
  • Code cleanup, especially concerning bool arguments and return values.

enn0x

Could someone explain how to compile the libraries for JSBSim (instead of using the precompiled libraries at the given JSBSim python bindings site)? I can’t seem to figure out how to do it in Visual Studio 2008–plus I want to use the latest release candidate of JSBSim (and Python 2.6).

I’m suspecting I might need GNU Make plus other dependencies, which is not going to be fun in Windows…

Thanks.

any plans to update this for Python 2.6?

Trying to get this to work and having 0 luck on any front. The demo won’t work because importing jsbsim errors out with “DLL load failed: the specified module cannot be found.” The JSBSim DLL isn’t on the SF.net page anymore but i found another one. Copied it half a dozen places and it still fails. So I tried to compile the source to make my own pyd but (after numerous code alterations to get the bits to point to the right places) that fails too due to numerous inheritance issues. (E.G: “error C2039: XXX is not a member of YY”) I tried just removing the various bits it was complaining about in hopes that it would compile anyway but after 3 files of this I gave up when it started failing on critical seeming bits like “set initial altitude.” Can anyone help? I’m trying to make a flight sim that will work with screen readers and I really, really, really don’t want to have to make it from scratch!

Hi !
I just tested JSBSimPython-0.2-Demo-Panda3D. It is a really good work and easy to use. I have a question. The speed on the top-left is the wind speed ?
If it is that, how can modify this ? I don’t find SetWindNED.
Thanks !

Sully