SITL with jsbsim and custom aircraft model

I have been using ardupilot with SITL simulation for some time, using my own custom aircraft model and the JSBSim simulator. However, now I can’t get the simulation up and running. I follow the guides from http://ardupilot.org/dev/docs/sitl-with-jsbsim.html and the other necessary, ardupilot provided guides, but when I write

sim_vehicle.py -v ArduPlane -f jsbsim:MyModel --console --map

the terminal process is stranded at

MAV> Waiting for heartbeat from tcp:127.0.0.1:5760

and the simulation is not started. I suspect that there is something wrong with the connection between jsbsim and ardupilot, and reinstalled jsbsim and pulled ardupilot (just in case). However, I don’t know where the connection in the jsbsim simulator is located and at the moment I search quite randomly in the code.

I would be very greatful if someone could give me a tip that could help me solve this problem.

That looks similar to a problem I had. I am checking with a colleague who figured out the solution. I hope to have an answer for you soon.

Hello, I’m also trying to do a custom model. Did you find any solution?
Thanks!

Here is what works for me:

sim_vehicle.py -C -v ArduPlane -f jsbsim:MyAircraft -j4 -L MySite --console -w --add-param-file=“MyParam.parm” -m “–load-module joystick”

As a start try

sim_vehicle.py -C -v ArduPlane

Then throw in the additional options gradually…

re: sim_vehicle.py -C -v ArduPlane -f jsbsim:MyAircraft -j4 -L MySite --console -w --add-param-file=“MyParam.parm” -m “–load-module joystick”

Where is the format of this parameter list documented ?

Does load-module joystick get passed onto MAVProxy or is the joystick input used elsewhere ?

try passing -h as the only flag to the executable to see if it dumps out the options. Alternatively you could just read the executable file where you could figure out what the options are.

For those having heartbeat issues with Jsbsim within SITL, the problem is associated with the incompatibility between the distributions of Ardupilot and jsbsim. If you are updating one it is a good idea to update the other at the same time. Before updating Jsbsim, make sure you remove the old program executable out of your search paths or just delete it. After the installation of the new jsbsim distribution, first test SITL with one of the standard models like the Rascal. If you get a heartbeat then the versions of the 2 packages are compatible.
After that, do the check with your own aircraft model. If it fails then the issue is with the compatibility of your model with the mew distribution of jsbsim that you just installed. Now you have debug the model to see what trips the error. You can run jsbsim as stand alone executable on your aircraft directly to catch some of the bugs. However I have to say jsbsim model debugging is a pain in the neck. I have not found a way to do it efficiently other than commenting out parts of the xml files here and there to isolate the problem area. Perhaps someone has a better approach to share…

cheers

1 Like

May i ask how did you modify the jsbsim model for your aircraft? How do you know what to change in the files for the aircraft? Is there a guide somewhere?

Hi @Aryan_Ghadge did you get info on it?
I am trying to do similar thing.