How does the Remote Control Server work?

Typically: "How do I... ", "How can I... " questions
Post Reply
Poseidonius
Posts: 7
Joined: 22 Feb 2013, 12:22

How does the Remote Control Server work?

Post by Poseidonius »

Hi everyone,

I would like to control a robot from MULTIPLE Python scripts via remoteAPI. Hence, I attached a child script to the related robot that includes a

simExtRemoteApiStart(newPortNb)

If I start just one script, the application works fine and the remote server offers an access to all elements of the robot. But a parallel execution of a second script addressing the same port does not generate a correct connection. I tested this behavior with the tutorial scripts. Do I have to start more than one remote Server? Which components are addressed by the function call "simExtRemoteApiStart"? Are all elements included that are in the component tree of the child script? Is it possible to select them and to provide an access to dedicated sensors seperatly?

Thanks for your effort

Poseidonius

Eric
Posts: 186
Joined: 11 Feb 2013, 16:39

Re: How does the Remote Control Server work?

Post by Eric »

Hi,

Each remote API client require a separate remote API server running on V-REP. This also means that a separate port is required. Each server running gives the client access to all objects in a scene.

Now, not sure about this 100%, but it could be that if you start the remote API on python, that the remote API library that is loaded is always the same (this depends on how you launch your scripts too I guess). If this is the case, then from Python you will only be able to execute one connection to V-REP. This should be improved in next release or so.


Cheers

Poseidonius
Posts: 7
Joined: 22 Feb 2013, 12:22

Re: How does the Remote Control Server work?

Post by Poseidonius »

Dear Eric,

thanks for your fast reply! I followed your advice and included a second RemoteApiStart in the child script:

newPortNb=19999
simExtRemoteApiStart(newPortNb)
newPortNb=20000
simExtRemoteApiStart(newPortNb)

Now 2 Python scripts can connect to the server, but just the first one gets an access to the components. All requests producing a error state. If I stop the first one, the second script works immediately. Any ideas?

Poseidonius

Eric
Posts: 186
Joined: 11 Feb 2013, 16:39

Re: How does the Remote Control Server work?

Post by Eric »

Hello,

well, it seems that Python will always refer to the same library loaded in memory. As a quick fix, you might try to copy the file "remoteApi.dll", rename it to "remoteApi2d.dll", then do the same with vrep.py (i.e. from "vrep.py" to "vrep2.py"). Then in vrep2.py, adjust the referencings correctly. This way you will be able to make 2 distinct connections from Python, by using vrep.py and vrep2.py

The remote API client will become multi-instance capable in future

Poseidonius
Posts: 7
Joined: 22 Feb 2013, 12:22

Re: How does the Remote Control Server work?

Post by Poseidonius »

Hi Eric,

thanks for your advice. I dont like this solution :-( Probably I will test the ROS interface.

Enjoy the weekend

Poseidonius

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

Re: How does the Remote Control Server work?

Post by coppelia »

Hello Poseidonius,

If you can get Python to load a new instance of the remote API library, then you should not have any problem. Maybe you just need to restart a new Pyrthon interpreter at each time.

And as Eric said, there will soon be a new version of the remote API capable of handling several connections in parallel from a same client.

Cheers

Poseidonius
Posts: 7
Joined: 22 Feb 2013, 12:22

Re: How does the Remote Control Server work?

Post by Poseidonius »

Great news! Thanks for this information ... is month of the submission allready known?

Best wishes

Poseidonius

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

Re: How does the Remote Control Server work?

Post by coppelia »

We will do our best for the next release... but I cannot guarantee it. But it has a high priority compared to other things!

Cheers

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

Re: How does the Remote Control Server work?

Post by coppelia »

Hello Poseidonius,

The "multiple connections from a same remote API client" feature has been implemented and will be available in next release (V3.0.3), that should be out within 2-4 weeks. If you contact us via the website, you can get the source code already now.

Cheers

Post Reply