learning-pick-and-place icon indicating copy to clipboard operation
learning-pick-and-place copied to clipboard

Patching cv_bridge for Python3

Open nily-dti opened this issue 4 years ago • 2 comments

In your README you write:

"Patching CvBridge for Python3 and CMake >= 3.12 is given by a snippet in GitLab."

Could you provide a link to the snippet you used? I assume that it's located on your local git server? Currently we're simply cloning vision_opencv (v. 1.12.8) into our repo and building that from source.

nily-dti avatar Nov 02 '20 13:11 nily-dti

Hi @pantor

We've been investigating this issue further, but would really appreciate your help with patching cv_bridge for py3.

The way we're installing cv_bridge at the moment can be seen in our Dockerfile, but we're still getting the ModuleNotFoundError.

root@4df58dbf8baf:/home/Workspace/catkin_ws# rosrun bin_picking grasping.py 
Traceback (most recent call last):
  File "/home/Workspace/catkin_ws/src/learning-pick-and-place/scripts/grasping.py", line 9, in <module>
    from utils.camera import Camera
  File "/home/Workspace/catkin_ws/src/learning-pick-and-place/scripts/utils/camera.py", line 9, in <module>
    from cv_bridge import CvBridge  # pylint: disable=E0611
ModuleNotFoundError: No module named 'cv_bridge'

Wierdly, if you open the Python interpreter directly in the terminal and execute from cv_bridge import CvBridge it finds the module with no issues, so I guess it's an issue with ROS and py3?

root@4df58dbf8baf:/home/Workspace/catkin_ws# python
Python 2.7.12 (default, Oct  5 2020, 13:56:01) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from cv_bridge import CvBridge
>>> CvBridge
<class 'cv_bridge.core.CvBridge'>
>>> 
root@4df58dbf8baf:/home/Workspace/catkin_ws# python3
Python 3.5.2 (default, Oct  7 2020, 17:19:02) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from cv_bridge import CvBridge
>>> CvBridge
<class 'cv_bridge.core.CvBridge'>
>>> 

To reproduce this, you can use our Docker image, there's a guide there to run it :+1:

nily-dti avatar Nov 03 '20 09:11 nily-dti

As a temp. fix we decided to remove the deps on cv_bridge. See: https://github.com/dti-research/learning-pick-and-place/commit/608e869eee17a89533cfa84922b7e6b3a5b5c127

We would still love to see what you did for "patching" cv_bridge for py3

nily-dti avatar Nov 03 '20 11:11 nily-dti