Board index FlightGear Support Interfacing

simple JSBSim example

Connecting two computers, using generic protocol, connecting with Matlab?

simple JSBSim example

Postby MrMinimal » Sat Oct 11, 2014 11:50 am

Hello everyone,

Over the last couple of weeks, I tried getting into JSBSim.
I read through the documentation, checked out the source code an was pointed to FlightGear as an example.
I'd really like to implement JSBSim in realtime with methods into a c++ project in order to test joystick input etc.

My biggest problem is the simplicity/complexity of the examples.

There is the simple approach of the documentation:

Code: Select all
copy_to_JSBsim(); // copy control inputs to JSBSim
fdmex->Run(); // execute JSBSim
copy_from_JSBsim(); // update the bus


or the entire code of FlightGears implementation of JSBSim.

Is there an easy example which uses JSBSim (e.g. some valuables as console output) ?

Any help is highly appreciated.

Best regards

Tom
MrMinimal
 
Posts: 17
Joined: Fri Sep 19, 2014 2:29 pm

Re: simple JSBSim example

Postby EliasTarasov » Thu Oct 30, 2014 12:16 pm

Suggestion:
1. Try steps that are pointed on p.79-84 JSBSim reference manual. It means that you must remove jsbsim.cpp(which contains main function). Otherwise you will have linker error about collision with your own main function in your main application.
2. Then instantiate FGFDMExec class. That allows you to modify internal JSBSim properties.
3. As far as i know, to test your keyboard or joystick input, you must change at runtime such properties like /fcs/aileron-cmd-norm and similar others to produce an impact on a model when it flies. So for example if you push button "Down", you have to change /fcs/elevator-cmd to produce pitch respectively.
EliasTarasov
 
Posts: 16
Joined: Sun Mar 16, 2014 8:16 am

Re: simple JSBSim example

Postby Hooray » Thu Oct 30, 2014 2:12 pm

Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: simple JSBSim example

Postby MrMinimal » Sun Mar 01, 2015 12:56 pm



JSBSim.minimal.cpp is quite the example I was looking for.
I just can't seem to compile it, since the compiler keeps giving me errors about files not being found.

Could you give me tipps what I should pass the compiler in order to get it working?

Thank you in advance

Tom

SOLUTION

In order to compile JSBSim.minimal.cpp you have to be in the jsbsim/ directory.
JSBSim needs to be compiled as a library (into jsbsim/build/ in this example)

g++ -o build/nameOfOutput.o src/JSBSim.minimal.cpp -Isrc -Lbuild/src -lJSBSim

(be aware that -Isrc is an i as in "include" and -lJSBSim is an l as in "library")

Then you can run nameOfOutput.o which is located in the build directory.
MrMinimal
 
Posts: 17
Joined: Fri Sep 19, 2014 2:29 pm


Return to Interfacing

Who is online

Users browsing this forum: No registered users and 6 guests