Created
December 5, 2022 14:02
-
-
Save Merwanski/b2f87a685c8cef11801751a303710ba7 to your computer and use it in GitHub Desktop.
cv_bridge_ros_python3.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTES: ROS Melodic -- Python3.7 | |
# Solution is to build cv_bridge with python3. | |
sudo apt-get install python-catkin-tools python3-dev python3-catkin-pkg-modules python3-numpy python3-yaml ros-melodic-cv-bridge | |
# Create catkin workspace | |
mkdir catkin_workspace | |
cd catkin_workspace | |
catkin init | |
# Instruct catkin to set cmake variables | |
catkin config -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.7m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so | |
# Instruct catkin to install built packages into install place. It is $CATKIN_WORKSPACE/install folder | |
catkin config --install | |
# Clone cv_bridge src | |
git clone https://github.com/ros-perception/vision_opencv.git src/vision_opencv | |
# Find version of cv_bridge in your repository | |
apt-cache show ros-melodic-cv-bridge | grep Version | |
Version: 1.13-0****** | |
# Checkout right version in git repo. In our case it is 1.13.0 | |
cd src/vision_opencv/ | |
git checkout 1.13.0 | |
cd ../../ | |
# Build | |
catkin build cv_bridge | |
# Extend environment with new package | |
source install/setup.bash --extend | |
# And you can test it with the following | |
$ python3 | |
Python 3.7.5 (default, Feb 23 2021, 13:22:40) | |
[GCC 8.4.0] on linux | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from cv_bridge.boost.cv_bridge_boost import getCvType | |
>>> | |
# Or add it to your bashrc file | |
source ~/catkin_workspace/install/setup.bash --extend | |
RESOURCES | |
- https://stackoverflow.com/questions/49221565/unable-to-use-cv-bridge-with-ros-kinetic-and-python3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment