Parallel Programming?

Requests or suggestions for new features
Post Reply
okan
Posts: 4
Joined: 25 Jul 2013, 15:52

Parallel Programming?

Post by okan »

I am working on multi-agent systems. When I run lots of robots in simulator, it gets very slow. Is there a way to parallelize sensor and physics engine of the simulator? Or will there be any new feature addressing this problem?

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

Re: Parallel Programming?

Post by coppelia »

Hello,

The sensing phase of the main simulation loop can run on several threads simultaneously. Check the item Enable work thread in the user setting dialog to enable/disable it. Check also the demo model that illustrates this (Models/components/sensors/Hokuyo_URG_04LX_UG01_Multithreaded) and the default main script code.

Beware that only the sensing phase can run in parallel, and only collision objects, distance objects and proximity sensors (vision sensors are based on OpenGl that doesn't allow multithreading). And only the objects marked as non-explicit handling will benefit from that. So unless you are heavily using above mentioned objects, there will not be a big difference.

Dynamics calculations cannot run in parallel to other things, otherwise the sensing and control will be biased: imagine you programmatically move a joint, run the dynamics calculation, and while it is still calculating, you move the joint again and do sensing at the same time (e.g. distance calculation). What will be the result of the dynamics if you move the joint in-between? What distance will the distance calculation produce? The distance of the joint in position 1 (first move command), position 2 (moved by the dynamics engine) or position 3 (moved by the second move command)?

However you can do real controller threading by using external controllers (e.g. remote API or ROS node). But there are benefits and negative points to each approach. Refer also to this section of the user manual.

Finally, we are currently working at embedding a high-fidelity physics engine, that will be able to run on several cores efficiently.

Cheers

Post Reply