Hello everybody!
I started tp use VREP and IP Python Notebook a few weeks ago so I don’t know to much of this kind of programms. The last week I try to appear a cube in front of poppy, but I can’t do that because of a ‘str’ trouble.
io = poppy._controllers[0].io
*# Création du cube devant Poppy
name = 'cube’
position = [0.2, 0, 0.8] # X, Y, Z
sizes = [0.1, 0.1, 0.1] # in meters
mass = 0.5 # in kg
io.add_cube((name, position, sizes, mass)
When I execute thats lines the program send me a Type Error message.
TypeError 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)
C:\Users\Me\Anaconda3\lib\site-packages\pypot\vrep\io.py in add_cube(self, name, position, sizes, mass)
228 def add_cube(self, name, position, sizes, mass):
229 “”" Add Cube “”"
–> 230 self._create_pure_shape(0, 239, sizes, mass, [0, 0])
231 self.set_object_position(“Cuboid”, position)
232 self.change_object_name(“Cuboid”, name)
C:\Users\Me\Anaconda3\lib\site-packages\pypot\vrep\io.py in _create_pure_shape(self, primitive_type, options, sizes, mass, precision)
261 “”" Create Pure Shape “”"
262 lua_code = “simCreatePureShape({}, {}, {{{}, {}, {}}}, {}, {{{}, {}}})”.format(primitive_type, options, sizes[0], sizes[1], sizes[2], mass, precision[0], precision[1])
–> 263 self._inject_lua_code(lua_code)
264
265 def _inject_lua_code(self, lua_code):
C:\Users\Me\Anaconda3\lib\site-packages\pypot\vrep\io.py in _inject_lua_code(self, lua_code)
265 def _inject_lua_code(self, lua_code):
266 “”" Sends raw lua code and evaluate it wihtout any checking! “”"
–> 267 msg = (ctypes.c_ubyte * len(lua_code)).from_buffer_copy(lua_code)
268 self.call_remote_api(‘simxWriteStringStream’, ‘my_lua_code’, msg)
269
TypeError: ‘str’ does not support the buffer interface
I don’t understand what I have to do, before exposing you this problem I have read something similar, they say that it’s a ‘str’ problem because we have to convert string to bytes.
Can everybody could help me please?
thanks