Creating Objects with Remote API

Typically: "How do I... ", "How can I... " questions
Post Reply
e2718
Posts: 33
Joined: 15 Nov 2015, 05:39

Creating Objects with Remote API

Post by e2718 » 02 Dec 2015, 22:09

I am trying to build a scene in VREP made of various objects and then run a simulation involving those objects. The objects that I am building will depend on the contents of a data file (.txt). If possible I would like to script this using a remote API (python) but there is no create object method in the remote API. Is there a way to do this using the remote API (python)? If not, how would I go about this using plug-ins or other methods?

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

Re: Creating Objects with Remote API

Post by coppelia » 03 Dec 2015, 00:21

Hello,

the remote API doesn't implement all the regular API functions. Just the most important ones. But if you need a special functionality that is not (yet) implemented on the remote API client side, then you can use a kind of messaging method between remote API client and script: e.g. the remote API client can send a signal that a script will intercept, and interpret.

Such a simple example is given in file programming/remoteAPIBindings/python/python/complexCommandTest.py. In next release, there will probably be a method that allows you to call a script function from a remote API client directly.

Cheers

e2718
Posts: 33
Joined: 15 Nov 2015, 05:39

Re: Creating Objects with Remote API

Post by e2718 » 04 Dec 2015, 09:43

Hello,

Can you give an example of this child script that can intercept the string stream? Thanks

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

Re: Creating Objects with Remote API

Post by Eric » 04 Dec 2015, 19:54

Hi!

To catch a string stream in an embedded script:

Code: Select all

	str=simGetStringSignal('myStringSignal')
	if str~=nil then
		simClearStringSignal('myStringSignal')
                -- from here str is the string that is sent from python
                -- parse it to extract the data to build your object with a regular API function
	end
I hope it helps...

Cheers

Eric

Post Reply