Running several scenes in parallel, is possible?

Typically: "How do I... ", "How can I... " questions
Guilherme.aut
Posts: 14
Joined: 13 Sep 2022, 17:22

Running several scenes in parallel, is possible?

Post by Guilherme.aut »

Hello!

I would like to know if there is the possibility of running several scenes in parallel?

I'm currently using:

- version 4.6.0 of Coppelia;
- python 3.11.5;
- ZeroMQ remote API;

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

Re: Running several scenes in parallel, is possible?

Post by coppelia »

Hello,

yes, you can run several simulations in parallel, you will however need to run several instances of CoppeliaSim. Each one should then use a different ZeroMQ remote APi server port. You can do this by starting CoppeliaSim as follows:

Code: Select all

coppeliaSim -GzmqRemoteApi.rpcPort=portNb
you might however need to append 2 dummy chars as in following example, depending on your CoppeliaSim version/revision (see also this reply):

Code: Select all

coppeliaSim -GxxzmqRemoteApi.rpcPort=portNb
Cheers

Guilherme.aut
Posts: 14
Joined: 13 Sep 2022, 17:22

Re: Running several scenes in parallel, is possible?

Post by Guilherme.aut »

Well, I need more information to understand this.

- I updated my Coppelia to: V4.6.0 rev14.
- I use ZeroMQ remote API.

- I currently connect to Coppelia like this:

client = RemoteAPIClient()
sim = client.require('sim')
sim.setStepping(True)
sim.startSimulation()
sim.setBoolParam(sim.boolparam_display_enabled,False)



- To connect multiple scenes in parallel, what do I need to do? What do I need to change? Is there a step-by-step guide explaining how to do this?

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

Re: Running several scenes in parallel, is possible?

Post by coppelia »

With CoppeliaSim V4.6.0 rev14 and later, you need to start each instance's ZeroMQ remote API server on a different port:

Code: Select all

coppeliaSim -GzmqRemoteApi.rpcPort=portNb
On the ZeroMQ remote API client side, you need to explicitly connect to one of the ports from above:

Code: Select all

client = RemoteAPIClient('localhost', portNb)
Cheers

Guilherme.aut
Posts: 14
Joined: 13 Sep 2022, 17:22

Re: Running several scenes in parallel, is possible?

Post by Guilherme.aut »

Right. What values ​​for "portNb" can I use? Could you give me some examples? Is there a list of recommended values?

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

Re: Running several scenes in parallel, is possible?

Post by coppelia »

e.g. 23001, 23002, 23003, etc.

Cheers

Guilherme.aut
Posts: 14
Joined: 13 Sep 2022, 17:22

Re: Running several scenes in parallel, is possible?

Post by Guilherme.aut »

Ok!

Just one more question. Should this command line "coppeliaSim -GzmqRemoteApi.rpcPort=portNb" be used in the Linux terminal to open Coppelia? Why don't I open Copppelia through the terminal. I looked for this on the internet and I didn't find anything.

Guilherme.aut
Posts: 14
Joined: 13 Sep 2022, 17:22

Re: Running several scenes in parallel, is possible?

Post by Guilherme.aut »

Ok, I think everything is fine here! The correct command line is ".\coppeliaSim.sh -GzmqRemoteApi.rpcPort=portNb".

Thank so much!!!!
Thank you for helping me! I am very grateful!

zhengkz
Posts: 17
Joined: 16 Jul 2021, 20:58

Re: Running several scenes in parallel, is possible?

Post by zhengkz »

Hi,

I wonder if I use coppeliasim.bridge.load() to open several instances in different threads. Do I still need to set the port for different instances? If it is needed, how to set that? Thanks!

Best,
Kz

fferri
Posts: 1230
Joined: 09 Sep 2013, 19:28

Re: Running several scenes in parallel, is possible?

Post by fferri »

No, coppeliasim.bridge doesn't use ZMQ remote API.

Post Reply