What are some important simulation speed enhancements?

Typically: "How do I... ", "How can I... " questions
Post Reply
geerten
Posts: 77
Joined: 14 Feb 2013, 13:57

What are some important simulation speed enhancements?

Post by geerten »

What are the most important things to enhance speed of the simulation?

I know, using pure shapes would be the best, but what if you have to use convex shapes? What can be done to decrease the time to calculate the next simulation step?

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

Re: What are some important simulation speed enhancements?

Post by coppelia »

This really is different from one simulation to the other. If a simulation doesn't use the dynamics functionality at all, then it doesn't matter having pure shapes, convex shapes, or random shapes.

Make sure to always inspect the timings at the top of the screen:

- in the main window bar you have the rendering time. Rendering can often significantly slow down a simulation. To avoid that, you can turn rendering off during simulation (have a look at model "models/other/fast simulation mode"), or you can skip some frames with the "rabbit" toolbar button

- You have all the execution timings like:
- Number of executed scripts, whether they are threaded or not. Remember to explicitely switch a threaded script when waiting for next simulation pass with simSwitchThread.
- The time needed by vision sensors. They can be quite calculation intensive
- The time needed by the physics engine. That timing can be improved by changing the simulation settings, favoring speed versus precision
- There are many more parameters that could be adjusted. But it really depends

Cheers

geerten
Posts: 77
Joined: 14 Feb 2013, 13:57

Re: What are some important simulation speed enhancements?

Post by geerten »

Ok, thanks for the tips.

Do you have any more specific guidelines to decreasing the time needed for the dynamics calculation?

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

Re: What are some important simulation speed enhancements?

Post by coppelia »

You will have to try for yourself: each simulation is different. Some "wobbly" simulation can be made to run very fast, since precision is not an issue. You can also try to disable friction or other specific physics engine parameters. Also refer to the Bullet or ODE documentation.

Cheers

geerten
Posts: 77
Joined: 14 Feb 2013, 13:57

Re: What are some important simulation speed enhancements?

Post by geerten »

By the way, in relation to this subject:

Any chance of making the software multi-threaded? It's a waste of all the processing resources I have on my laptop...

Thanks.

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

Re: What are some important simulation speed enhancements?

Post by coppelia »

If you write controllers connecting to V-REP via the remote API or ROS, then you will benefit from the other cores. Everything that uses the scripting, doesn't. One of the reason is:

The simulation loop needs to by synchronous for many situations, typically, we have in a simulation loop (in that order):

1. Action (e.g. moving objects, running IK, running physics)
2. Sensing (e.g. reading data for graphs, reading vision sensors, proximity sensors, etc.)
3. Display

Try to mix all of above's items, it will be a mess: sensors will miss some simulation passes (which is ok in many situations, but not always), resources will need to be locked anyway (thus hindering other threads to access them), etc.

Cheers

Post Reply