Skip to content
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

cv_bridge_boost error on ROS example policy #119

Open
titouanlh opened this issue May 26, 2020 · 1 comment
Open

cv_bridge_boost error on ROS example policy #119

titouanlh opened this issue May 26, 2020 · 1 comment

Comments

@titouanlh
Copy link

titouanlh commented May 26, 2020

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.

@titouanlh
Copy link
Author

titouanlh commented May 26, 2020

[Update]
I've been able to solve the issue following this tutorial : https://github.com/pulver22/gym-gazebo/wiki/ERROR:-Cv_bridge-for-Python3
So now I source the GQCNN package and I extend it with the cv-bridge python3 package.
But it leads to an other issue which is the following :

libgcc_s.so.1 must be installed for pthread_cancel to work

I have no idea how to solve this, I've made a lot of research on the internet and I have not been able to fix it.

Maybe I've done something wrong in the previous steps ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant