this is a desktop-full ros on melodic version compiled with python3 and opencv 4
sudo apt install python3-rosdep python3-rosdistro python3-rosinstall-generator python3-vcstool python3-rosinstall build-essential
sudo apt install python3-sip-dev
mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws
rosinstall_generator desktop_full --rosdistro melodic --deps --tar > melodic-desktop-full.rosinstall
mkdir src
vcs import src < melodic-desktop-full.rosinstall
rosdep install --from-paths src --ignore-src --rosdistro melodic -y
some python-ros*
packages should be installed such as python-rospkg
. I don't konw why and what the impact will be.
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-B tag] [-c dir] [-d file] [-D] [-e] [-f] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-P] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-X id:file] [-y file] [-z file] [@file] [file]
the cmd is
/usr/bin/sip -c /home/shuyuanhao/ros_catkin_ws/build_isolated/qt_gui_cpp/sip/qt_gui_cpp_sip -b /home/shuyuanhao/ros_catkin_ws/build_isolated/qt_gui_cpp/sip/qt_gui_cpp_sip/pyqtscripting.sbf -I /usr/share/sip/PyQt5 -w -n PyQt5.sip -t Qt_5_9_5 -t WS_X11 -x PyQt_WebChannel -x PyQt_Desktop_OpenGL qt_gui_cpp.sip
change sip_flags
in ros_catkin_ws/src/python_qt_binding/cmake/sip_configure.py
as
sip_flags = sip_flags.replace('-n PyQt5.sip ', '')
print(sip_flags)
cmd += sip_flags.split(' ')
cmd.append(sip_file)
print(cmd)
subprocess.check_call(cmd)
change CMakeLists.txt
, use ubuntu 18.04 defualt opencv 4.1.1
#find_package(OpenCV 3 REQUIRED
# COMPONENTS
# opencv_core
# opencv_imgproc
# opencv_imgcodecs
# CONFIG
#)
# set(OpenCV_DIR "/home/shuyuanhao/opencvlib/4.5.2/share/opencv4/")
find_package(OpenCV 4 REQUIRED
COMPONENTS
opencv_core
opencv_imgproc
opencv_imgcodecs
CONFIG
)
see offical code