Skip to content
/ jsbsim Public
forked from JSBSim-Team/jsbsim

An open source flight dynamics & control software library in C++

License

Notifications You must be signed in to change notification settings

alios/jsbsim

 
 

Repository files navigation

Travis CI (Linux) AppVeyor CI (Windows)
Travis CI Build status

Introduction

JSBSim is a multi-platform, general purpose object-oriented Flight Dynamics Model (FDM) written in C++. The FDM is essentially the physics & math model that defines the movement of an aircraft, rocket, etc., under the forces and moments applied to it using the various control mechanisms and from the forces of nature. JSBSim can be run in a standalone batch mode flight simulator (no graphical displays) for testing and study, or integrated with FlightGear or other flight simulator.

More information on JSBSim can be found at the JSBSim home page here:

http://www.jsbsim.org

Getting the source

The GitHub repository of JSBSim is reachable at this link: github.com/JSBSim-Team/jsbsim. This repository mirrors the original one on SourceForge: sourceforge.net/projects/jsbsim.

What you need to download the source

You need to have the Git software installed. Git is a version control software, a system that records changes to a file or set of files over time so that you can recall specific versions later. The JSBSim software source code files are being version controlled by Git.

To install Git go to its download site and grab the version for your platform. You can choose to use Git locally on your computer in two ways: via one of the GUI clients, or through a command shell (e.g. a Bash shell on Linux or Windows).

Once you have installed Git, assuming you are going to use Git from the command shell, the JSBSim source code public repository can be cloned from one of the two following locations.

Downloading from SourceForge

In such case the Git command to clone the repo is (HTTPS mode)

> git clone https://git.code.sf.net/p/jsbsim/code jsbsim-code

or (SSH mode)

> git clone git://git.code.sf.net/p/jsbsim/code jsbsim-code

Downloading from GitHub

in such case the Git command to clone the repo is (HTTPS mode)

> git clone https://github.com/JSBSim-Team/jsbsim.git jsbsim-code

or (SSH mode)

> git clone git@github.com:JSBSim-Team/jsbsim.git jsbsim-code

Building JSBSim

JSBSim can either be built with CMake or Microsoft Visual Studio. If you are using a Mac OSX or a Linux platform, you must use CMake. If you are a Windows user you can use either one.

JSBSim is coded in standard C++98/C99 and has no dependencies, so all you need is a C/C++ compiler installed on your platform.

Building with CMake

CMake is a multiplatform tool to build and test software. It can produce files to build JSBSim with GNU make or Microsoft Visual Studio. To keep the build files separated from the source code, it is preferable to build JSBSim in a separate directory.

> cd jsbsim-code
> mkdir build
> cd build

CMake does not build software, it produces files for a multitude of build tools. The following commands are assuming that you are using GNU make to build JSBSim.

First, you should invoke CMake and then execute make

> cmake ..
> make

This will compile the various classes, and build the JSBSim application which will be located in build/src

Options passed to CMake

CMake can use a number of parameters to tune the build of JSBSim. Different options are presented below. You can use them independently or any combination thereof depending on your needs.

Passing parameters to the compiler

If you want to set compiler options, you can pass flags to CMake to build a Debug version of JSBSim. JSBSim also uses C for some code, you can set options for both the C++ and the C compiler.

> cmake -DCMAKE_CXX_FLAGS_DEBUG="-g -Wall" -DCMAKE_C_FLAGS_DEBUG="-g -Wall" -DCMAKE_BUILD_TYPE=Debug ..
> make

Or alternatively you can build a Release version of JSBSim and request GNU Make to use 4 cores to build the executable faster.

> cmake -DCMAKE_CXX_FLAGS_RELEASE="-O3 -march=native -mtune=native" -DCMAKE_C_FLAGS_RELEASE="-O3 -march=native -mtune=native" -DCMAKE_BUILD_TYPE=Release ..
> make -j4

Building Expat or using the system library

JSBSim uses the Expat library to read XML files. The Expat source code is provided with JSBSim source code and is compiled along with JSBSim during its build. However, if Expat is already installed on your platform you might prefer to use your system Expat library in order to avoid duplication. In that case, you should pass the SYSTEM_EXPAT flag to CMake:

> cmake -DSYSTEM_EXPAT=ON ..
> make

Building shared libraries

Most of JSBSim code can be built as a shared library, so that the executable JSBSim and the Python module can share the same library which reduce the memory and disk space consumption. The option BUILD_SHARED_LIBS must then be passed to CMake

> cmake -DBUILD_SHARED_LIBS=ON ..
> make

Building the Python module of JSBSim

A Python module of JSBSim can also be built by CMake. For that, you need Cython installed on your platform. CMake will automatically detect Cython and build the Python module.

Building with Microsoft Visual Studio

From Visual Studio, you can open the project file JSBSim.vcxproj to open a project for JSBSim. The project file will setup Visual Studio for building the JSBSim executable.

Note 1: JSBSim official build tool is CMake. Visual Studio project files are provided as a convenience and are not guaranteed to be up to date with the code.

Note 2: Since Visual Studio 2017, Microsoft has included CMake so you can build JSBSim on VS2017 directly from the CMake file.

For more detailed instructions on using Visual Studio project files and CMake via Visual Studio to build JSBSim take a look at the following documentation link - Building using Visual Studio.

Testing JSBSim

JSBSim comes with a test suite to automatically check that the build is correct. This test suite is located in the tests directory and is coded in Python so you need the [Python module for JSBSim to be built].

The tests are also using numpy, pandas and scipy so you need these Python modules to be installed on your system.

The test suite can then be run using ctest in the build directory. Tests can also be run in parallel on several cores (4 in the example below) using the option -j

> ctest -j4

Installing JSBSim

Once JSBSim is built and tested, you can install the C++ headers and library. For that, you can invoke GNU make from the build directory

> make install

By default, CMake copies the files to a location where the headers and library are available platform wide (typically /usr/include, /usr/lib or /usr/local/include, /usr/local/lib for *nix OSes). If you want to install the files in another location you can pass the flag CMAKE_INSTALL_PREFIX to cmake.

cmake -DCMAKE_INSTALL_PREFIX=/path/to/install ..
make
make install

Installing the Python module

If you plan to install the Python module of JSBSim in addition to the C++ headers and library, then you must pass the flag INSTALL_PYTHON_MODULE to CMake

> cmake -DINSTALL_PYTHON_MODULE=ON ..
> make
> make install

Alternatively, the Python module can be installed manually by invoking the following command from the build directory

> python tests/setup.py install

Documentation

A first place to look at for JSBSim documentation resouces is http://jsbsim.sourceforge.net/documentation.html. This link points to the official JSBSim Reference Manual, a PDF which is the best source of information for users and developers.

However, due to the nature of the development of the project (JSBSim sources are updated often, sometimes even daily), several new features that are available in the software are not yet documented in the reference manual. Starting from March 2018 a new effort is underway to deliver an up-to-date documentation web site. You can browse the new JSBSim Online Reference Manual by going to: https://jsbsim-team.github.io/jsbsim-reference-manual. The online manual is under construction and as a first milestone it will incorporate all the non-outdated material contained in the original PDF Reference Manual. The online manual web site is based on the GitHub Pages technology and its sources are available here. Eventually, the PDF Reference Manual will be superseded by the online manual, which is designed to be updated collaboratively as well as in efficient and timely fashion.

The JSBSim API documentation can be viewed here.

Contact

For more information on JSBSim, you can contact the development team on the mailing list jsbsim-devel@lists.sourceforge.net or submit tickets on https://github.com/JSBSim-Team/jsbsim/issues

About

An open source flight dynamics & control software library in C++

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 74.0%
  • C 8.3%
  • Python 5.3%
  • XSLT 3.5%
  • Objective-C 3.0%
  • PHP 2.5%
  • Other 3.4%