请确保已经正确安装了ROS 、OPENCV、realsense-viewer。
编译出现第一个问题
`-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
– ~~ traversing 5 packages in topological order:
– ~~ - realsense2_camera_msgs (plain cmake)
– ~~ - realsense2_description (plain cmake)
– ~~ - ddynamic_reconfigure
– ~~ - realsense2_camera (plain cmake)
– ~~ - usb_cam
– ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkin_workspace.cmake:100 (message):`
指三个错误的包不能编译的意思?
问题是没有正确完成对realsense-ros的处理!
进入realsense-ros文件夹
cd ~/catkin_ws/src/realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ~/catkin_ws
catkin_make clean
catkin_make
编译出现第二个问题
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
指为找到OPENCV,需要在:~/catkin_ws/src/realsense-ros/realsense2_camera内的CMakeLists.txt内于find_package()上添加:set(OpenCV_DIR /usr/local/share/OpenCV/)
注意目录