Gazebo | Ignition | Community
Ask Your Question

Bottleneck in real time factor

asked 2022-10-03 08:40:02 -0600

AVR gravatar image

Hello all,

I am working on a project where I am training an UAV with a simple genetic algorithm. I am using gazebo, ROS and SITL. I already managed to evolve the controller in a few hundred simulations but this takes some hours.

Therefore, my objective is to run the simulation faster. I already tried to set the update_rate to 0, but my real time factor keeps between 0.6 and 1 (1.05 on tops). I found that when I erase the drone of the world, the real time factor goes to 30-40. I am using the Iris drone model from ardupilot. I am a little bit confused about this because my CPU usage is 20-30% during the runs, with gzserver having the most CPU % usage. I already search in many potst and questions but I cant find anything that works. Is there anything that you suggest me to do?

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-10-04 03:13:36 -0600

Veerachart gravatar image

Complex collisions (especially using mesh geometries), CPU ray sensors, and complex models (with a lot of joints and links) are some of the possible cause of slow simulation. Model and world plugins can also slow down the real-time factor if they are doing something heavy inside callback functions to physics-related events (world update begin, world update end, for example).

I found the Iris drone from this repo, not sure if it's the same one as you are running or not. A quick check doesn't see mesh collisions or CPU ray sensors, and the model doesn't look that complicated. The plugins may do something complex for calculating the drone's dynamics (I didn't check this). You can probably try to load the world without the plugins to see if it's still slow or not (very likely that it won't fly). If it's fast, then it's likely those plugins.

You can also reduce the <max_step_size> parameter to make it faster, but the accuracy of physics can go down.

Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2022-10-03 08:40:02 -0600

Seen: 150 times

Last updated: Oct 04 '22