按照上述连接中的教程一步步安装,到 构建工作区中
mycobot_ros
的代码这一步,会出现错误,如下:
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake:113 (message):
Project 'cv_bridge' specifies '/usr/include/opencv' as an include dir,
which is not found. It does neither exist as an absolute directory nor in
'${{prefix}}//usr/include/opencv'. Check the issue tracker
'https://github.com/ros-perception/vision_opencv/issues' and consider
creating a ticket if the problem has not been reported yet.
Call Stack (most recent call first):
/opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:76 (find_package)
mycobot_ros/mycobot_280/mycobot_280/CMakeLists.txt:6 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/nvidia/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/nvidia/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
参考 https://blog.csdn.net/ayfen/article/details/121085025
解决办法:
这不是因为我们编写的程序有误,而是NVIDIA的32.3.1image自带的是opencv4版本,把opencv命名成了opencv4
修改方法:只需修改上述路径中的cv_bridgeconfig.cmke文件,将100行附近的两个opencv改成opencv4即可(注意,只需要改动单独一个的opencv,前面有连字符的opencv不需要改动)
注意:如果jetson nano的版本自带的opencv是3版本,可能不会出现此问题
修改命令: sudo gedit /opt/ros/melodic/share/cv_bridge/cmake/cv_bridgeConfig.cmake
修改成opencv4即可
如何查看本机opencv版本?
第一步:输入
cd /usr/bin
进入目录
然后输入:
./opencv_version