Why the simulation time goes very slowly?

Typically: "How do I... ", "How can I... " questions
Post Reply
wode
Posts: 18
Joined: 12 Oct 2019, 03:47

Why the simulation time goes very slowly?

Post by wode »

Hello,
I set the simulation parameters as the default values :Bullet2.7, Accurate(default), dt=50ms(default).
However, when i start the simulation, the simulation time goes very slowly. Simulation time add 50ms takes about 3 seconds of the real time. And this cause that the simulation looks very slow.

The configuration of my computer is CPU: intel i7-9700k , GPU: RTX 2070 with enough 16GB RAM, and i try to simulation my project in a server with 2*RTX6000 and Intel Xeon Silver 4210.
However, the simulation time also goes very slowly.

So why my simulation time goes so slowly and how to fix the problem?

Sinserely

wode
Posts: 18
Joined: 12 Oct 2019, 03:47

Re: Why the simulation time goes very slowly?

Post by wode »

Anyone can help me?
Thanks

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Why the simulation time goes very slowly?

Post by coppelia »

Hello,

simulation time depends on various factors. As you mentioned it it will also depend on the hardware you are using. But often more importantly is the type of simulation (i.e. simulation content) and functionality you are using. So maybe you can post the scene that is problematic?
Is it possible that the shapes are very heavy (i.e. lots of vertices/triangles)?

Cheers

wode
Posts: 18
Joined: 12 Oct 2019, 03:47

Re: Why the simulation time goes very slowly?

Post by wode »

Thank you!

I use vrep to simulate the UAVs control and there are about 200 quadricopters in my scene.
The most used functions in my scene are get/setObjectPosition, readVisionSensor and so on.
Besides, I use matlab to compute the UAV control algorithm and send the UAVs' velocities to vrep. Then vrep feedback the positions and other information to matlab.

And my question are :
1. Which takes more simulation time ? The communication between vrep and matlab or the vrep simulation process?
2.How to speed up the simulation time ?
3. I use the video record of vrep and find the time in video record is real time, but the simulation time is much longer than record time. Why?

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: Why the simulation time goes very slowly?

Post by coppelia »

About your questions:

1. it depends on many factors: how is communication achieved? Are you using blocking function calls, or non-blocking calls and data streaming? When just reading a simple value from CoppeliaSim, constantly, the communication delay is normally less than 10ms per simulation step. Simulation time also heavily depends on the simulation content (with heavy content like in your siutation, simulation time will be quite large)

2. You first need to analyze where the bottleneck is. My guess is that you have many vision sensors that require quite some time. So you could e.g. instead of handling vision sensors in each simulation step, do it in every 5th simulation step for instance. You can easily achieve this by flagging a vision sensor as explicit handling and calling sim.handleVisionSensor on it every 5th simulation step.

3. You always need to differentiate between real time and simulation time. If simulation content is light, then you can use the real-time button to have the simulation run at the similar time as real-time. If the content is heavy, you don't have any other choice than to adjust the real-time to the simulation time, i.e. have the real-world wait for each simulation step to finish. This is typically achieved by having the real-world (e.g. Matlab in your case) trigger each simulation step and updating its own time accordingly. In CoppeliaSim you would use the synchronous mode.
When you use the built-in video recording functionality, then you can restore a real-time appearance (since CoppeliaSim will only record one image for each simulation step, by default). But if you use an external video recording functionality, you'd have to manually remove many frames afterwards in order to restore a real-time appearance.

Cheers

Post Reply