Multi threading Gazebo


I am trying to do simulation of PX4 using gazebo (SITL), I am using iris model with optical flow camera, However I am
trying to simulate several IRIS at the same time, The problem is that when I add several IRIS model, the Real time factor decreases to 0.1 . The Frame rate stays at 60 fps.

I have Intel(R) Xeon(R) CPU E5-2609 v4 @ 1.70GHz (16 core physically) and gazebo is using only one core at the time.

Do you have any idea how to make multi-thread simulation using gazebo?? Or how to simulate several IRIS more efficiently in gazebo ??

I have also two Pixhawk hardware that can allow HITL simulation, Do you think that I can advantage of the hardware to reduce the load on gazebo? I know that The Real time factor is decreasing because of the physics of the quadcopters but I am trying to take advantages of any thing that can make simulation time factor better.

Best regards,

My understanding is that gazebo is multithreaded natively in the current gazebo 7 - 9 distributions.

I believe what is slowing you down with multiple models is that you are running multiple plugins for each models which will take up alot of process.


I am using gazebo 9.
I have only copied the model of the iris with optical flow several time after starting the simulation with PX4, during the simulation I monitor the occupation of the processor, and it is only one core that occupied at the a time.

Later I have inserted the same model from the gazebo model online repository, I copied it several times, at the end I have the same results.
The Real time factor decreases very badly, even it become very hard to do the simulation.

@shrit You cannot copy the model of iris in gazebo. You are just copying the models in gazebo.

To do multivehicle simulation using SITL, you have to launch different models in the launchfile.

You can follow the instructions here

Thanks for your answer,

I have already crossed this tutorial. I tried to avoid it because it is using ROS.

Apparently it is the only solution that exist, I will try to do it, but finally I do not know if real time factor in gazebo will not be affected.

We will discuss the results once I have finished creating the lunch file.

Best Regards,

Maybe you can try to use the precedent version?

The precedent versions has a lot of compatibility issue, especially in code,
I have to compile using the last version of g++
I am using v1.8.0