How to get real-time SITL in gazebo with multi-vehicle?

Hi.

I am doing multi-vehicle simulation in Gazebo. All works fine except that the ‘Real Time Factor’ in Gazebo is less than one, and it decreases when I add more vehicles. The following picture shows a simulation snapshot of 6 drones (I want to add more!). I am using mavros to interface to PX4.

Here are the issues

  • As you can see, the real time factor is less than 1
  • in the terminal where I run the SITLs of all vehicles, I get a flood of ERROR [mavlink] [timesync] Hard setting offset.

I guess I have a good machine with 56 cores and 126G RAM.

Here is the sys monitor during the simulation:

Question 1 Are these error message fine to ignore, or they indicate serious issues?
Question 2 How can I keep the real-time factor in Gazebo at 1, if the machine specs are sufficient?

More info

  • using Ubuntu 16 with ROS Kinetic
  • using master branch of PX4 at commit 78a9658; not latest!

Thanks.

Hi,
I would recommend to run px4 sitl process on dedicated CPU core. And also forbid OS to run other process on this core. I think you will have to modify ros launch files to have one command launch only px4 node. I don’t have full instructions but maybe this link would help

Also you may want to turn off Gazebo GUI, which is as simple as setting gui = false parameter in ros launch file.