Creating Objects for VREP using Python

I am trying to follow this tutorial to add and interact with objects in V-REP with the ErgoJr.

However, when I run:

io = poppy._controllers[0].io
io.add_sphere(‘sphere1’, [0,0,.5],[.1,.1,.1],0.25)

I get the error:

VrepIOErrors: Remote error

The code is specifically failing when I try to add objects.
Any ideas?

@sforestier Any ideas?

Hello! The API was created by @Pierre 3 years ago to be able to send Lua code to VREP because there was no python bindings for creating new shapes on the fly and it was possible only through Lua code.
If those functions do not work anymore I guess that the Lua API of VREP changed, which gives you this error.
Maybe @Theo can have a look ? :slight_smile:

I have the same issue (can’t create any object in VREP for the ErgoJr)
I may have a clue.
I followed the same tutorial and it is still working for the PoppyTorso. (ie, i am able to add object for the PoppyTorso)
But, when i try with a PoppyErgoJr, the error raise.

I try a cube, a sphere and a cylinder with the same issue
I also try to change the scene…
poppy = PoppyErgoJr(simulator='vrep',scene='poppy_ergo_jr_holder.ttt')
I upgraded pypot, poppy-creature and poppy-ergo-jr to the last version.

poppy-creature (2.0.0)
poppy-ergo-jr (2.0.0)
poppy-torso (2.0.1)
pypot (3.1.1)

And to change the name ‘cube’ to ‘bcube’ as suggested in a other post
VrepIOErrors Traceback (most recent call last)
in ()
3 sizes = [0.1, 0.1, 0.1] # in meters
4 mass = 0.5 # in kg
----> 5 io.add_cube(name, position, sizes, mass)

VrepIOErrors: Remote error

with no result…
Any idea ?



Hi @sepro,

So, me, I may have a “WTF” issue

When the bug comes, it is in

when Pypot asks, if the objects are already in the scene? if not, he asks Vrep

and, with ergo, you opted an error

if you create an object (cube, sphere, etc) directly in Vrep, you can modify it with the pypot command. (because, the ‘if the objects are already in the scene?’ is true)

So, it’s strange, because at no time do, pypot or lua interface, call any specific function of creatures.

I thinks that, in the scene .ttt, ergo are seen like a object and Torso not.
But, when you alternate and repeat connection to the ergo and connection to the torso like:

from poppy.creatures import *
poppy= PoppyTorso(simulator='vrep')
io = poppy._controllers[0].io
name = 'Cuboid'\n
position = [0.2, 0, 0.8] # X, Y, Z\n
sizes = [0.1, 0.1, 0.1] # in meters\n
mass = 0.5 # in kg\n
io.add_cube(name, position, sizes, mass)
poppy= PoppyErgoJr(simulator='vrep')
io = poppy._controllers[0].io
io.set_object_position('Cuboid', [0.15,0.05,0.8])

without restart vrep, rapidly the problem (create any object in VREP) appeared with Torso.

So, I think, the bug is in the ergo scene… but how and where… I don’t know