Skip to content

cv_bridge_boost error on ROS example policy #119

@titouanlh

Description

@titouanlh

System information

  • OS Platform and Distribution : Ubuntu 16.04
  • Python version: 3.5.2
  • Installed using pip or ROS: ROS Kinetic
  • GPU model (if applicable): no GPU

Describe the result you are trying to replicate
I'm trying to use the example ROS policy

Provide the exact sequence of commands / steps that you executed to replicate this result
From Ubuntu Xenial fresh install, installed ROS Kinetic
Then made a Python 3.5.2 virtualenv, cloned and installed GQCNN and autolab_core packages
Installed alll dependancies and built with catkin_make

In order to be able to import cv2 I had to add the following in /my/virtualenv/path/lib/python3.5/site-packages/perception/image.py :

import sys
sys.path.remove('opt/ros/kinetic/lib/python2.7/dist-pkg')
import cv2
sys.path.append('opt/ros/kinetic/lib/python2.7/dist-pkg')

instead of import cv2 only
Maybe it is related

Describe the unexpected behavior
The ROS graspins policy works but the python example doesn't, I get the following error

ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)
[INFO] [1590483364.054702]: signal_shutdown [atexit]
[INFO] [1590483364.064572]: topic[/rosout] removing connection to /rosout
[INFO] [1590483364.065849]: atexit

Other info / logs
Here's the traceback

Traceback (most recent call last):
  File "examples/policy_ros.py", line 125, in <module>
    grasp_resp = plan_grasp_segmask(color_im.rosmsg, depth_im.rosmsg,
  File "/home/actemium/gqcnn_ve/gqcnn_ve/lib/python3.5/site-packages/perception/image.py", line 250, in rosmsg
    return cv_bridge.cv2_to_imgmsg(self._data, encoding=self._encoding)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 259, in cv2_to_imgmsg
    if self.cvtype_to_name[self.encoding_to_cvtype2(encoding)] != cv_type:
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2
    from cv_bridge.boost.cv_bridge_boost import getCvType

I guess the problem comes from Python 3.5.
I tried using GQCNN with Python 2.7 but I always get a cannot import name ABC error.
I tried building the ROS package with
catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so
(from https://stackoverflow.com/questions/49221565/unable-to-use-cv-bridge-with-ros-kinetic-and-python3)
but this doesn't solve the issue
I also tried adding the "vision_opencv" ROS package in my workspace but I'd doesn't work either.

Thank you for your answers and your work on this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions