Change between 4.6.0 and 4.10.0 for legacy remote API?

Typically: "How do I... ", "How can I... " questions
Post Reply
johnh
Posts: 12
Joined: 10 Mar 2015, 21:06

Change between 4.6.0 and 4.10.0 for legacy remote API?

Post by johnh »

Hi

I've been using V-rep/CoppeliaSim for about 10 years and have quite a lot of python code that uses the legacy remote API. I'm currently converting this to use the zmq based remote API, one remote component at a time. However, a few days ago I upgraded CoppeliaSim from 4.6.0 to 4.10.0 and now the code using the old API is no longer working as before.

One of the remote components makes use of a permanent service on port 19997, configured in remoteApiConnections.txt as

portIndex1_port = 19997
portIndex1_debug = false
portIndex1_syncSimTrigger = true

Using 4.6.0, a component can connect using SimxStart(), set up a scene and monitor changes, and then disconnect using simxFinish() several times in succession without problem and without restarting the simulator. However, in 4.10.0 this component connects and works as before the first time, but after is disconnects and reconnects the simulator seems to time out on every query and I have to restart the simulator. I can see that the network connection disappears on disconnection and that re-connection is successful e.g. using netstat, and simxStart returns 0 the second time it is called as if all is well, but after that all calls timeout and the final simxFinish call never returns.

Here's some code to demonstrate:

from time import sleep

from coppelia.sim import simxFinish, simxStart, simxGetPingTime

host = '127.0.0.1'
port = 19997

def run():
clientid = simxStart(host, port, True, True, 1000, 5)
if clientid == -1:
print("could not connect to simulation")
else:
print(f"virtual world interface connected to simulator as client ID {clientid} on port {port}")

code, ping_time = simxGetPingTime(clientid)
print(f'Ping time in synch mode: {ping_time} ms')

ret = simxFinish(clientid)
print(f'return from simxFinish: {ret}')

run()
sleep(1)
run()

The second call to run() succeeds as expected, but not the second. The output is

virtual world interface connected to simulator as client ID 0 on port 19997
Ping time in synch mode: 110 ms
return from simxFinish: None
virtual world interface connected to simulator as client ID 0 on port 19997
Ping time in synch mode: 5008 ms

and the second simxFinish() call never seems to return.

Any calls for example to get object handles succeed immediately in the first run, but during the second each call returns after about 5s with error code 3.

Is this an expected change in behaviour between these CoppeliaSim versions? Do I perhaps need to change configuration somehow?

Thanks for any help!
John.
coppelia
Site Admin
Posts: 10804
Joined: 14 Dec 2012, 00:25

Re: Change between 4.6.0 and 4.10.0 for legacy remote API?

Post by coppelia »

Hello John,

please excuse the late replay, due to summer vacation.

The legacy remote API is deprecated since several years(in favor of the ZeroMQ remote API), and has finally been discontinued in CoppeliaSim V4.10 (and later). So do not expect it to work with those versions anymore.

Cheers
johnh
Posts: 12
Joined: 10 Mar 2015, 21:06

Re: Change between 4.6.0 and 4.10.0 for legacy remote API?

Post by johnh »

Hello - many thanks for your response.

I realised that the legacy API has been deprecated for a while, but hadn't seen an announcement that it was actually discontinued in 4.10. In fact it is still present and for most part continues to work, so I thought it worth mentioning what seemed to be a new bug.

Anyway, I'm safely migrated to the zmq remote API now.
Post Reply