facebookresearch / tacto

Simulator of vision-based tactile sensors.
MIT License
329 stars 72 forks source link

experiments/grasp_data_collection.py digit rendering error #14

Open shivanimall opened 3 years ago

shivanimall commented 3 years ago

Hi @robertocalandra,

I am on a macOS, I am rendering using physicsClient = pb.connect(pb.GUI) instead of physicsClient = pb.connect(pb.DIRECT) in experiments/grasp_data_collection.py and note I also tried changing the visualize sensor argument to True when initializing digits.

these lines result in the following error: color, depth = digits.render() digits.updateGUI(color, depth)


    color, depth = digits.render()
  File "/Users/shivanimall/tacto/tacto/sensor.py", line 274, in render
    color, depth = self._render_static()
  File "/Users/shivanimall/tacto/tacto/sensor.py", line 245, in _render_static
    colors, depths = self.static
  File "/Users/shivanimall/tacto/tacto/sensor.py", line 238, in static
    colors, _ = self.renderer.render(noise=False)
  File "/Users/shivanimall/tacto/tacto/renderer.py", line 515, in render
    color, depth = self.r.render(self.scene)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyrender/offscreen.py", line 102, in render
    retval = self._renderer.render(scene, flags, seg_node_map)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyrender/renderer.py", line 125, in render
    self._update_context(scene, flags)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyrender/renderer.py", line 738, in _update_context
    p._add_to_context()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pyrender/primitive.py", line 324, in _add_to_context
    self._vaid = glGenVertexArrays(1)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/OpenGL/latebind.py", line 41, in __call__
    return self._finalCall( *args, **named )
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/OpenGL/wrapper.py", line 674, in wrapperCall
    raise err
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/OpenGL/wrapper.py", line 667, in wrapperCall
    result = wrappedOperation( *cArguments )
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/OpenGL/error.py", line 228, in glCheckError
    raise GLError(
OpenGL.error.GLError: GLError(
    err = 1282,
    description = b'invalid operation',
    baseOperation = glGenVertexArrays,
    pyArgs = (1, <object object at 0x12050f2d0>),
    cArgs = (1, array([3], dtype=uint32)),
    cArguments = (1, array([3], dtype=uint32))
)```

seems like comes from pyrender - 
shivanimall commented 3 years ago

looks similar to this https://github.com/mmatl/pyrender/issues/169

shivanimall commented 3 years ago

Hello @robertocalandra, would appreciate if you can take a look at this, thank you!

1/ also, have a digit related question: I understand that digit is just another mesh object, but wondering what are the units of the default loaded digit object?

wx405557858 commented 3 years ago

Hi @shivanimall, yeah, it seems that macOS would have this error. It might caused by conflicting flags between pyrender & pybullet on macOS. Does the pb.DIRECT works for you? Also, is there any chance you could try to run it at Ubuntu? It can be much easier to set up. We will add this recommendation to the README.

The unit of digit should follow the default unit of URDF, which is meters.

shivanimall commented 3 years ago

thanks for the response @wx405557858. yes, pb.Direct does work but that will create a headless simulation. Being able to visualize my simulation would be helpful for my problem. unfortunately, I don't have access to a linux machine with a GUI either.

Any other workarounds so that I can visualize the depth/color maps and see the GUI for the gripper in action?

shivanimall commented 3 years ago

Hi @wx405557858 - Erwin from bullet mentioned a support for this: https://github.com/bulletphysics/bullet3/discussions/3844

wx405557858 commented 3 years ago

Hi @shivanimall ,

Wow, this is awesome! So multi-processing should solve the problem! I probably don't have enough bandwidth for testing it this month, but can look into it in the summer! If you are interested, would you mind giving it a try and we can merge the code if it works! Thank you!

shivanimall commented 3 years ago

Hi @wx405557858,

yes indeed!! yes, I am giving this a try, and that sounds great :) will update once I have something working.