auto-shutdown command remoteAPI strange behavior

Report crashes, strange behaviour, or apparent bugs
Post Reply
aldarin
Posts: 1
Joined: 20 May 2016, 23:02

auto-shutdown command remoteAPI strange behavior

Post by aldarin »

Hello,

I have an executable using the remoteAPI that checks on the status of VREP in order to determine if it should continue running.
a remoteApiServer is started in the child script, and the client in a c++ executable.

if (simxGetConnectionID!= -1) works wonderfully if I stop the simulation from VREP and then close VREP.

However strange behavior comes when I use some of the command-line commands
I use the -s -q arguements (autostart simulation and autoshutdown vrep when sim done).
when the simulation stops, vrep closes (due to -q), but simxGetConnectionID continues to return a non -1 value.

this obviously causes the external program to continue believing the connection is value, despite the fact that vrep is closed and the remoteApi server should have closed when the simulation ended.

I have no clue what the behavior of the getConnectionID is behind the scenes, so any information there would be appreciated.

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

Re: auto-shutdown command remoteAPI strange behavior

Post by coppelia »

Hello,

you are right. It seems that there is a bug when connecting to the continuous remote API server service.
As a work around, you can use something like following in your client main loop (example is for Python client):

Code: Select all

    r=1
    while clientID!=-1 and r!=-1:
        r,info=vrep.simxGetInMessageInfo(clientID,vrep.simx_headeroffset_scene_id)
        print ('r,info: ',r,info)
    vrep.simxFinish(clientID)
Above works only if a first message has arrived at the client side.

Cheers

Post Reply