rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
696 stars 342 forks source link

Fix drawtrimesh interface when compiled with pybind11 #1238

Closed gywn closed 1 year ago

gywn commented 1 year ago

The affected code section allows drawtrimesh to accept an array of color attributes that match the triangle array. This is more efficient than creating many draw handles because OpenGL can consume this array of color attributes directly. This functionality was impacted when using pybind11 to compile the Python interface.

cielavenir commented 1 year ago

@gywn please avoid auto type, I pushed it (thank you for allowing pushing from the maintainer)

cielavenir commented 1 year ago

By the way I'm a little unclear, do you mean ocolors is not GCed until PyGraphHandle is GCed and your patch fixes that?

gywn commented 1 year ago

@cielavenir What failed in my build is extract<boost::multi_array<float,2> >(ocolors). It seems pybind11::object::cast does not support boost::multi_array. I look through the code base and it seems this is the only place where such a conversion is considered. Runtime error message from pybind11:

Exception RuntimeError: u'Unable to cast Python instance to C++ type (compile in debug mode for details)' in <finalize object at 0x7ff9cce81d00; dead> ignored

And sorry about the auto, I was unaware/ignorant about this coding style in Mujin/OpenRAVE.

rdiankov commented 1 year ago

thanks~