赞
踩
上面的两篇博客安装都异常顺利,甚至没有一点报错,实际安装中显然是不可能的
安装环境
看一下官网的 Requirements
这里 CUDA
是选装的,CUDA 要求是10.0的,而我是11的,而且 Eigen 版本也不一样,所以编译时没有选择 CUDA,后面有实际需要再说
下载 autoware.ai.repos
时出错,怎么都下载不下来
wget -O autoware.ai.repos "https://raw.githubusercontent.com/autowarefoundation/autoware_ai/1.12.0/autoware.ai.repos"
直接去查看这个文件,复制到 autoware.ai.repos 即可
repositories: autoware/common: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/common.git version: 1.12.0 autoware/core_perception: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/core_perception.git version: 1.12.0 autoware/core_planning: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/core_planning.git version: 1.12.0 autoware/documentation: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/documentation.git version: 1.12.0 autoware/messages: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/messages.git version: 1.12.0 autoware/simulation: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/simulation.git version: 1.12.0 autoware/utilities: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/utilities.git version: 1.12.0 autoware/visualization: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/visualization.git version: 1.12.0 drivers/awf_drivers: type: git url: https://gitlab.com/autowarefoundation/autoware.ai/drivers.git version: 1.12.0 citysim: type: git url: https://github.com/CPFL/osrf_citysim.git version: 27bd05bc6c762b3ad8c9bb85f678d4b7ce7a27c5 car_demo: type: git url: https://github.com/CPFL/car_demo.git version: e364448fad421cb6244c9f828f978d8d877dcbf9 drivers/ds4: type: git url: https://github.com/tier4/ds4.git version: 5aa2f7f53a67992fffa7c801ed9c663a380b5d4a
rosdep install
的时候提示缺少相关包
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
缺什么安装什么,例如 sudo apt-get install ros-melodic-nmea-msgs
redwall@redwall-G3-3500:~/autoware$ rosdep install -y --from-paths src --ignore-src --rosdistro $ROS-DISTRO
WARNING: given --rosdistro -DISTRO but ROS_DISTRO is "melodic". Ignoring environment.
WARNING: ROS_PYTHON_VERSION is unset. Defaulting to 2
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
autoware_bag_tools: Cannot locate rosdep definition for [nmea_msgs]
kitti_box_publisher: Cannot locate rosdep definition for [jsk_recognition_msgs]
range_vision_fusion: Cannot locate rosdep definition for [jsk_topic_tools]
runtime_manager: Cannot locate rosdep definition for [nmea_navsat_driver]
as: Cannot locate rosdep definition for [pacmod_msgs]
autoware_camera_lidar_calibrator: Cannot locate rosdep definition for [image_view2]
lidar_euclidean_cluster_detect: Cannot locate rosdep definition for [jsk_rviz_plugins]
没用 CUDA 用下面的语句编译
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
这里遇到了很多问题,可以归类两个大问题
安装 ROS 时会安装 3.2.0
版本的 OpenCV,后面自己又安装了 3.4.16
版本的 OpenCV
之前不晓得从哪里看来的博客,两个版本都安装到了 /usr/local/
目录下,那么后安装的 3.4.16 版本的 OpenCV 就会覆盖之前的 3.2.0 版本的
那么就会导致版本的混乱,同时在 build 目录下 sudo make uninstall
时会把 3.2.0 版本的也一起卸载掉,这就导致很多 ROS 基础的功能包都找不到 OpenCV 头文件
卸载重装 OpenCV 3.4.16,注意制定安装路径为 /usr/local/opencv-3.4.16
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv-3.4.16 ..
make 编译前可以 nproc
查看处理器核心数量,充分利用核心数量进行多线程编译
安装完成后在bashrc
文件末尾增加如下语句
export PKG_CONFIG_PATH=/usr/local/opencv-3.4.16/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/local/opencv-3.4.16/lib
export OpenCV_DIR=/usr/local/opencv-3.4.16
加入前两条语句后,pkg-config能发现opencv
加入第三条语句后,能在CMakeLists.txt中直接通过FIND_PACKAGE(OpenCV REQUIRED)
命令找到opencv
对于 OpenCV 3.2.0,也是重新安装,用下述命令卸载
sudo apt-get remove 'libopencv*'
会随着卸载很多软件包,记录下来,再重新安装,OpenCV 3.2.0 用下述命令重新安装
sudo apt-get install 'libopencv*'
至此,编译时报错对 cv::Mat() 未定义的引用
解决
代码中opencv2风格的代码与opencv3风格代码混用,报了很多错误
/home/fengbro/autoware.ai/src/autoware/core_perception/vision_lane_detect/nodes/vision_lane_detect/vision_lane_detect.cpp:514:58: error: could not convert ‘cv::Scalar_((double)0, (double)255, (double)255, (double)0)’ from ‘cv::Scalar {aka cv::Scalar_}’ to ‘CvScalar’
cvPoint(frame_size.width/2, frame_size.height), CV_RGB(255, 255, 0), 1);
vision_lane_detect.cpp文件,修改其中第514行代码:
CV_RGB(255, 255, 0) —> cvScalar(255, 255, 0)
/home/fengbro/autoware.ai/src/autoware/core_perception/vision_lane_detect/nodes/vision_lane_detect/vision_lane_detect.cpp:544:30: error: conversion from ‘cv::Mat’ to non-scalar type ‘IplImage {aka _IplImage}’ requested
IplImage frame = cv_image->image;
vision_lane_detect.cpp文件的第544行中:
IplImage frame = cv_image->image;-----> IplImage frame = cvIplImage(cv_image->image);
/home/fengbro/autoware.ai/src/autoware/core_perception/vision_darknet_detect/src/vision_darknet_detect.cpp:228:17: error: no match for ‘operator=’ (operand types are ‘IplImage {aka _IplImage}’ and ‘cv::Mat’)
ipl_image = final_mat;
修改vision_darknet_detect.cpp文件的第228行:
ipl_image = final_mat; 为 ipl_image = cvIplImage(final_mat);
/home/fengbro/autoware.ai/src/autoware/core_perception/vision_beyond_track/include/detection.h:234:21: error: conversion from ‘cv::Mat’ to non-scalar type ‘CvMat’ requested
CvMat cvmat = sum_mat;
在detection.h文件的第234行下一行添加如下内容
for(size_t i=0; i< sum_mat.rows; ++i)
for(size_t j=0; j< sum_mat.cols; ++j)
((double*)(cvmat.data.ptr + i*cvmat.step))[j] = sum_mat.at<double>(i,j);
/home/fengbro/autoware.ai/src/autoware/core_perception/trafficlight_recognizer/nodes/region_tlr/region_tlr.cpp:143:63: error: no match for ‘operator=’ (operand types are ‘CvPoint’ and ‘cv::Point {aka cv::Point_<int>}’)
textOrg = cv::Point(ctx.topLeft.x, ctx.botRight.y + baseline);
修改region_tlr.cpp文件的第143行如下
textOrg = cvPoint(ctx.topLeft.x, ctx.botRight.y + baseline);
顺利安装后会提示如下信息
---
Finished <<< trafficlight_recognizer [18.1s]
Summary: 139 packages finished [52.9s]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。