Open a new RemoteAPI service from within a plugin

Typically: "How do I... ", "How can I... " questions
Post Reply
alex.cani
Posts: 6
Joined: 28 Feb 2018, 12:53

Open a new RemoteAPI service from within a plugin

Post by alex.cani » 14 Mar 2019, 19:32

Hi! I'm trying to figure out a way (if even possible) of opening up RemoteAPI services dynamically from within a plugin, sort of to act like a broker that opens up ports on request of external clients.

I can execute any call to the regular API by importing and loading the V-Rep library, but given simRemoteApi.start is not defined by the core library I'm not sure how to proceed.

Any thoughts?

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

Re: Open a new RemoteAPI service from within a plugin

Post by coppelia » 15 Mar 2019, 16:38

You can define a custom function inside of a customization script. Then you can have your plugin call that function via simCallScriptFunctionEx.

Cheers

alex.cani
Posts: 6
Joined: 28 Feb 2018, 12:53

Re: Open a new RemoteAPI service from within a plugin

Post by alex.cani » 16 Mar 2019, 00:32

coppelia wrote:
15 Mar 2019, 16:38
You can define a custom function inside of a customization script. Then you can have your plugin call that function via simCallScriptFunctionEx.

Cheers
I see, but this would require some specific scene containing an object to which the script is attached. While not a deal-breaker, I'd rather have this done scene-independently.

Is communication between a plugin and an Add-on possible? Instead of calling a customization script it could call some function defined in the add-on.
What concerns me in this approach is the following comment regarding add-ons:
"While simulation is not running, add-ons should not call API functions that make sense only when simulation is running." Does this apply to opening a remote api service? Given it's not opened either from remoteApiConnections.txt at startup or from a script, but from something in-between,

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

Re: Open a new RemoteAPI service from within a plugin

Post by coppelia » 18 Mar 2019, 15:10

In V-REP V3.6.1 rev1, available within 24 hours, you should be able to call simCallScriptFunctionEx on add-on scripts too.

Cheers

alex.cani
Posts: 6
Joined: 28 Feb 2018, 12:53

Re: Open a new RemoteAPI service from within a plugin

Post by alex.cani » 18 Mar 2019, 15:24

coppelia wrote:
18 Mar 2019, 15:10
In V-REP V3.6.1 rev1, available within 24 hours, you should be able to call simCallScriptFunctionEx on add-on scripts too.

Cheers
That's awesome! Great work and thank you!

Post Reply