Python ZMQ simpleClient not working

Report crashes, strange behaviour, or apparent bugs
Post Reply
Andres
Posts: 18
Joined: 06 Oct 2023, 09:06

Python ZMQ simpleClient not working

Post by Andres »

Hi, any program I run in CoppeliaSim with the Python client generates the same bug. I get a message in the center of the screen that says:

Connectivity >> ZMQ Remote API server@addOnScript: abort execution

When this message appears, the lines of code I wrote run properly. But the screen in the simulation is frost. I cannot do anything in the simulation (like changing the perspective or zooming with the mouse). I have to wait for the simulation to stop, the be able to move again in the scene screen.

If I click on that message that appears on the center of the screen. The simulation keeps running and now the screen is not frost. But also my code stops executing, it loses connection with CoppeliaSim. Also, if I want to run code again, it is not possible because the connection is not possible. This because the ZMQ Remote API Server gets an error. So I have to go manually to Modules -> Connectivity and there restart it manually.

This problems occurs with every single code I try. Even with your simpleTest.py from yout GitHub repository.

Can someone tell me how to make this message not appear any more and let my simulations run normally.

My environment is:
CoppeliaSim v.4.6.0 rev 2
Windows 11
python 3.11.5
coppeliasim_zmqremoteapi_client (0.1.0)

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

Re: Python ZMQ simpleClient not working

Post by coppelia »

Hello,

this is a very strange behaviour. Normally, when this message appears, this means that one or several clients generated an error, and CoppeliaSim is waiting in vain for a reply from that client.
In next revision (rev4), normally out tomorrow, if you interrupt the ZeroMQ remote API server, it will restart automatically again. That should make things a bit easier.

However, I still do not understand what exactly is happening on your side. Normally when CoppeliaSim hangs as you described, then the client is not running anymore. But in your case, it seems it is still running. If you freshly start CoppeliaSim and simply run the original programming/zmqRemoteApi/clients/python/simpeExample.py, are you sure that CoppeliaSim hangs?

Cheers

lumeqi
Posts: 29
Joined: 04 Dec 2023, 06:20

Re: Python ZMQ simpleClient not working

Post by lumeqi »

This error also occurs when multiple robots in coppeliasim run at the same time using ZMQ and multithreading through python. How to solve it

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

Re: Python ZMQ simpleClient not working

Post by fferri »

How do you mean "using ZMQ and multithreading"?

lumeqi
Posts: 29
Joined: 04 Dec 2023, 06:20

Re: Python ZMQ simpleClient not working

Post by lumeqi »

Yes.
Of course, I'm using a multi-channel approach to synchronize multiple robotic arms. Do you have any way to support the synchronous operation of multiple robotic arms

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

Re: Python ZMQ simpleClient not working

Post by fferri »

It depends on the specific operation you want to do.

E.g. if you are moving your arm with Ruckig, you can setup your trajectory with sim.ruckigPos or sim.ruckigVel and then call sim.ruckigStep repeatedly, for every arm (that's the implementation of sim.moveToConfig).

Btw, the ZMQ Remote API client is not thread safe, so you can use it only from 1 thread. You can however create multiple clients, one for each thread, but probably there is no reason to.

lumeqi
Posts: 29
Joined: 04 Dec 2023, 06:20

Re: Python ZMQ simpleClient not working

Post by lumeqi »

Yes, I am setup my trajectory with sim.ruckigPos or sim.ruckigVel and then call sim.ruckigStep repeatedly.
If you run coppeliasim with a single thread and create multiple robotic arm clients, the robotic arms can only run in series, not all the robotic arms in parallel. This method can not realize multi-arm coordination and joint control simulation.

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

Re: Python ZMQ simpleClient not working

Post by fferri »

lumeqi wrote: 20 Feb 2024, 04:13 If you run coppeliasim with a single thread and create multiple robotic arm clients
You only need 1 client for that.

Post Reply