Page 1 of 1

Python ZMQ simpleClient not working

Posted: 06 Nov 2023, 13:28
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)

Re: Python ZMQ simpleClient not working

Posted: 06 Nov 2023, 19:54
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

Re: Python ZMQ simpleClient not working

Posted: 19 Feb 2024, 07:23
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

Re: Python ZMQ simpleClient not working

Posted: 19 Feb 2024, 09:19
by fferri
How do you mean "using ZMQ and multithreading"?

Re: Python ZMQ simpleClient not working

Posted: 19 Feb 2024, 09:51
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

Re: Python ZMQ simpleClient not working

Posted: 19 Feb 2024, 10:25
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.

Re: Python ZMQ simpleClient not working

Posted: 20 Feb 2024, 04:13
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.

Re: Python ZMQ simpleClient not working

Posted: 20 Feb 2024, 09:55
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.