Lightweight or Command line SITL Simulation Options


I’ve been able to follow the Simulation Dev Guide and use SITL with:

  1. jMAVSim
  2. Gazebo

However, both have nice but computationally intense graphic displays which are too slow for my application. Thus, I’m wonder if there is either:

  • A way to run the above SITL without the graphics?
  • Or, a command line SITL (e.g. using jSBSim) controlled only using QGC

To put this questions in perspective, the utility I’m looking for is to

  1. Compile custom module for SITL
  2. Run SITL mission with custom set of waypoints
  3. Download ulog data files and analyse results

This is being done on an Ubuntu-VM, which slows things down. Using the standard jMAVSim actually leads to flight instability due to the slow down.

Thanks in advance.

For anyone else facing this issue here is a solution worked out by a team member:

  1. Edit this file, which is part of jMAVSim repository,, and change setVisible(true) to

  2. Run the command ant in the terminal to recompile jMAVSim

Now jMAVSim will no longer have a GUI and hence the SITL experience will run much faster, albeit without the graphic visual. Qgroundcontrol can still be used to interact with plane.


Thanks @hamid-m that’s quite useful. We should add a command line option.

The Gazebo simulation consists of a physics simulator gzserver and a GUI gzclient. You can run it headlessly, i.e. without the GUI by simply not starting gzclient.

PX4 supports this with by setting the HEADLESS variable:

HEADLESS=1 make posix_sitl_default gazebo
1 Like

Thank you @Nicolas. This was a helpful way to run gazebo without the GUI.

Do you have any advice for getting the headless gazebo to run lighter? When running on a virtual machine the combination of:

  1. posix px4
  2. headless gazebo
  3. QGC

seems to be slow enough as to affect the aircraft controls and lead to instability. For example, get the entire setup to run at half the update rate.

I am seeing the same issues as you. Running SITL gazebo headless on my MBP 2015, the flight performance is visibly affected by high CPU load. Unfortunately it seems px4 is not running on simulation time, but rather on system time, albeit synchronizing the two clocks every now and again as evidenced by the many “simulator is slow” messages. This is a shortcoming of the SITL simulation and may be worth opening an issue on Github.

As for your setup, the only thing I can suggest is running QGC on your host OS, although I doubt that makes a significant difference.

Thanks for confirming the issue and possible source.

Two ideas come to mind to reduce the SITL computational burden:

  1. Reduce the system rates
  2. Connect PX4 to simulation time

@Nicolas mentioned the second approach and how that would take changing where posix-px4 sources time. It seems the first approach may be easier. For example, halve the rates of all systems (e.g. sensors from 500 Hz to 250 Hz, estimators and controllers again run at halve the nominal rate, as should message RX/TX).

Does anyone have experience or thoughts on this with Gazebo? I found where to change the simulation rate from the world model. For the plane world model: can specify simulation rate and maximum step size. But without making changes elsewhere it the system will again be unstable. It seems this needs changes to:

  • Posix PX4
  • Gazebo
  • mavlink RX/TX on both sides

This was very helpful

Thanks !!