cv_bridge error running on ROS Noetic, python 3.6, Jetson AGX Xavier

asked 2022-05-27 03:43:33 -0600

haj gravatar image

Hi there,

I have installed ROS Noetic on my Jetson AGX Xavier from Source. I am using a Docker Container that has OpenCV 4.5 with CUDA installed and Python 3.6 on my Jetson AGX Xavier to run ROS. I installed ROS Noetic from source onto it because it supports Python 3 and OpenCV 4 natively. The system runs Jetpack 4.6.2 (Ubuntu 18.04). I know that Noetic is tailored for Ubuntu 20.04 but it should work nonetheless according to this docker file from NVidia.

I am trying to use cv_bridge for an image processing node in python analogously to the example code in the cv_bridge tutorials.

First, I got the following error:

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

So I added import ctypes libgcc_s = ctypes.CDLL('libgcc_s.so.1') to my python script. It resolved it. But then I am getting an error when calling

cv_image = self.bridge.imgmsg_to_cv2(data, "bgra8")

which I cannot seem to solve:

[ERROR] [1653638408.163983]: bad callback: <bound method image_converter.callback of <__main__.image_converter object at 0x7f9c00acf8>>
File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
cb(msg)
File "/catkin_ws/src/arc_bridge_detection/src/cv_bridge_node.py", line 20, in callback
cv_image = self.bridge.imgmsg_to_cv2(data, "bgra8")
File "/opt/ros/noetic/lib/python3/dist-packages/cv_bridge/core.py", line 163, in imgmsg_to_cv2
dtype, n_channels = self.encoding_to_dtype_with_channels(img_msg.encoding)
File "/opt/ros/noetic/lib/python3/dist-packages/cv_bridge/core.py", line 99, in encoding_to_dtype_with_channels
return self.cvtype2_to_dtype_with_channels(self.encoding_to_cvtype2(encoding))
File "/opt/ros/noetic/lib/python3/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2
from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: /opt/ros/noetic/lib/python3/dist-packages/cv_bridge/boost/cv_bridge_boost.so: undefined symbol: _ZN5boost6python6detail11init_moduleER11PyModuleDefPFvvE

Something with my cv_bridge, python and opencv installations is not quite right. Note in order to build cv_bridge on Python 3.6, I edited Line 11 in the CMakelists.txt from

find_package(Boost REQUIRED python37)

to

find_package(Boost REQUIRED python3)

Has anyone encountered a similar problem and could possibly help me with this? Any advice is much appreciated!

edit retag flag offensive close merge delete