-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for python bindings #120
base: master
Are you sure you want to change the base?
Conversation
Can build shared library for python bindings by specifying -DBUILD_PYTHON=ON when calling cmake. This requires pybind11 to be cloned into build's parent directory. The python bindings expose a very minimal interface: it allows construction of a `GraspDetector` and calling `detectGrasps` which accepts a previously instantiated `GraspDetector` and a point cloud as a numpy array (of shape (n, 3)). This function returns a numpy array of shape (number of grasps, 14) where the columns specify the position, orientation (rotation matrix in row-major order), the width of the gripper, and the score of the grasp.
One remark is that it seems like the Eigen predictor segfaults if the weights file is not found. |
I am just another user of the repo that looking into these features recently. Wondering what is the difference between this implementation and the one in https://github.com/atenpas/gpd/blob/master/src/detect_grasps_python.cpp. P.S. I am not familiar with cpp2python binding at all, so please excuse me for some silly questions. |
I guess this stackoverflow is the answer to |
I was unaware actually of that method you linked. I just used pybind because I've used it before and it works nicely with numpy arrays. I haven't tried it, but do you know if the cdll/the existing python code will let you pass in a numpy array? |
I am testing it at the moment. Still cannot get it compiled. But will report back if I got anything from it. |
FYI, the provide binding detect_grasps_python.cpp works with some modification, and numpy array can be pass through that ctypes python interface. |
Accept position of the camera to be input to the point cloud.
Fixed bug introduced with setting camera viewpoint. Adding some testing code as well.
Hi, after I install your branch, I use the commend 'python3 test.py', the python shows "No module named gpd_python". I use the following commend when I install your branch: I already installed pybind11 under the parent dir, and no error occurred during compiling. However, "No module named gpd_python". Maybe there should be a "setup.py" file that I can "python setup.py develop" to install "gpd_python"? or Any step I wrongly ran caused "No module named gpd_python" |
The library might be inside the
Let me know if these don't work. Thanks. |
It works, Thanks!! |
Hi @pvmilk, |
@anmakon Sorry for the late response. I searched through my system and cannot find the patch anymore. Sorry to give a false expectation. |
Can build shared library for python bindings by specifying
-DBUILD_PYTHON=ON when calling cmake. This requires pybind11
to be cloned into build's parent directory. The python bindings
expose a very minimal interface: it allows construction of a
GraspDetector
and callingdetectGrasps
which accepts apreviously instantiated
GraspDetector
and a point cloud as anumpy array (of shape (n, 3)). This function returns a numpy
array of shape (number of grasps, 14) where the columns specify
the position, orientation (rotation matrix in row-major order), the width
of the gripper, and the score of the grasp.