文章目录
- 一、下载Autoware1.15源码
- 二、安装依赖
- 三、修改CUDA版本
- 四、编译以及报错解决
- 编译
- (1)报 `undefined reference to cv::Mat::Mat() `的错就按照下面方式改相应包:
- (2)遇到报错:
- (3)报错:`error: conversion from ‘cv::Mat’ to non-scalar type ‘CvMat’ requested`,将报错那句改为:
- (4)报错`error: no match for ‘operator=’ (operand types are ‘CvPoint’ and ‘cv::Point {aka cv::Point_<int>}’`,将下面这句中的`cv::Point`改为`cvPoint`:
- (5)报错,找不到cuDNN的头文件:
- (6)报错, op_tlr包未找到cuDNN的库:
在Autoware1.14配置的环境基础上安装Autoware1.15,解决一些报错
环境配置参考Autoware1.14的安装教程:Ubuntu18.04安装autoware 1.14(GPU版) 完整教程(包含环境搭建)
一、下载Autoware1.15源码
下载地址(注意包含了完整的Autoware,并不是只有Openplanner
):https://github.com/hatem-darweesh/autoware.ai.openplanner
mkdir src
下载代码:
vcs import src < openplanner.1.15.repos
二、安装依赖
sudo apt-get install libnl-3-dev libnl-genl-3-dev
sudo apt-get install ros-melodic-tvm-vendor
sudo apt-get install ros-melodic-lanelet2-io ros-melodic-lanelet2-core ros-melodic-lanelet2-maps ros-melodic-lanelet2-projection ros-melodic-lanelet2-routing ros-melodic-lanelet2-validation
三、修改CUDA版本
src/autoware/common/autoware_build_flags/cmake下的CUDA版本改为11.4(或者你电脑上的版本)
四、编译以及报错解决
编译
UTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
# 编译特定的包
UTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-select lidar_kf_contour_track
(1)报 undefined reference to cv::Mat::Mat()
的错就按照下面方式改相应包:
find_package(OpenCV 3.4 REQUIRED)
include_directories(
${OpenCV_INCLUDE_DIRS}
)
target_link_libraries(target ${OpenCV_LIBS})
(2)遇到报错:
error: could not convert 'cv::Scalar_<double>((double)0,(double)255,(double)255,(double)0,)' from 'cv::Scalar {aka cv::Scalar_<double>}' to 'CvScalar' error:conversion from 'cv::Mat' to non-scalar type 'IplImage {aka _IplImage}' requested
将CV_RGB
改为cvScalar
使用cvIplImage()
函数将类型转换一下:
(3)报错:error: conversion from ‘cv::Mat’ to non-scalar type ‘CvMat’ requested
,将报错那句改为:
CvMat* cvmat;
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);
}
(4)报错error: no match for ‘operator=’ (operand types are ‘CvPoint’ and ‘cv::Point {aka cv::Point_<int>}’
,将下面这句中的cv::Point
改为cvPoint
:
// textOrg = cv::Point(ctx.topLeft.x, ctx.botRight.y + baseline);
textOrg = cvPoint(ctx.topLeft.x, ctx.botRight.y + baseline);
(5)报错,找不到cuDNN的头文件:
/usr/local/cuda-11.4/include/cudnn.h:61:10: fatal error: cudnn_ops_infer.h: No such file or directory CMake Error at op_tlr_generated_network_kernels.cu.o.Release.cmake:225 (message):
在Autoware1.14环境配置时,安装cuDNN把所有的头文件都复制过去:
# sudo cp include/cudnn.h /usr/local/cuda/include/
sudo cp include/cudnn*.h /usr/local/cuda/include/
(6)报错, op_tlr包未找到cuDNN的库:
/usr/bin/ld: cannot find -lcudart /usr/bin/ld: cannot find -lcublas /usr/bin/ld: cannot find -lcurand /usr/bin/ld: cannot find -lcudnn
发现是Cmakelists.txt中CUDA的库文件包含路径错误,在op_tlr包中改成自己的CUDA版本