Autoware.universe 安装步骤
克隆Autoware到本地
mkdir autoware_universe
cd autoware_universe/
git clone https://github.com/autowarefoundation/autoware.git -b humble
注意ROS的版本
安装NVIDIA 显卡驱动
若输入 sudo nvidia-smi 检查英伟达驱动出现以下报错:
Failed to initialize NVML: Driver/library version mismatch
NVML library version: 550.90
原因是NVIDIA 内核驱动与系统驱动版本不一致,按照网上提出的方法使用sudo rmmod nvidia 命令退出当前内核使用的显卡模块,重新加载升级后版本的显卡驱动作为我们的内核模块发现此方法不可行
最后解决办法为:
卸载驱动
sudo apt-get purge nvidia*
查找本机内核版本
cat /proc/driver/nvidia/version
发现为550.90.07
于是尝试安装550版本的驱动
sudo apt-get install nvidia-driver-550 nvidia-settings nvidia-prime
出现报错
正在解压 libnvidia-compute-550:amd64 (550.90.07-0ubuntu1) 并覆盖 (550.90.07-0ubuntu0.22.04.1) ... dpkg: 处理归档 /tmp/apt-dpkg-install-WqT5B5/04-libnvidia-compute-550_550.90.07-0ubuntu1_amd64.deb (--unpack)时出错: 正试图覆盖 /usr/lib/x86_64-linux-gnu/libnvidia-gpucomp.so.550.90.07,它同时被包含于软件包 libnvidia-gl-550:amd64 550.90.07-0ubuntu0.22.04.1 dpkg-deb: 错误: 粘贴 子进程被信号(Broken pipe) 终止了
具体是 libnvidia-compute-550 和 libnvidia-gl-550 包在更新时发生了冲突
强制卸载冲突的包
sudo dpkg --remove --force-remove-reinstreq libnvidia-compute-550 libnvidia-compute-550:i386
sudo dpkg --remove --force-remove-reinstreq libnvidia-gl-550 libnvidia-gl-550:i386
清理已损坏的包和未完成的安装:
sudo apt-get clean
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get -f install
重新安装NVIDIA驱动
sudo apt-get install nvidia-driver-550 nvidia-settings nvidia-prime
重新生成内核模块
sudo dkms autoinstall
重启系统以应用更改
sudo reboot
再次使用 nvidia-smi 检查驱动显示驱动正常
安装ROS2 humble
鱼香ros一键安装:
wget http://fishros.com/install -O fishros && . fishros
安装ros2_dev_tools
sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
python3-colcon-common-extensions \
python3-flake8 \
python3-pip \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget
python3 -m pip install -U \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest \
setuptools
安装 Ansible
sudo apt-get purge ansible
sudo apt-get -y update
sudo apt-get -y install pipx
python3 -m pipx ensurepath
pipx install --include-deps --force "ansible==6.*"
cd autoware/
ansible-galaxy collection install -f -r "ansible-galaxy-requirements.yaml"
安装 Build Tools
sudo apt-get update
sudo apt-get install -y ccache
安装 Dev Tools
sudo apt-get install -y git-lfs
git lfs install
pip3 install pre-commit
pip3 install clang-format==18.1.8 --user --extra-index-url=https://pypi.tuna.tsinghua.edu.cn/simple
sudo apt-get install -y golang
sudo apt-get install -y ros-${ROS_DISTRO}-plotjuggler-ros
安装 gdown
pip3 install gdown
安装 geographiclib
sudo apt install geographiclib-tools
sudo geographiclib-get-geoids egm2008-1
安装rmw_implementation
# 注意官网给的是mian,humble的
wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env
sudo apt update
rmw_implementation_dashed=$(eval sed -e "s/_/-/g" <<< "${rmw_implementation}")
sudo apt install ros-${rosdistro}-${rmw_implementation_dashed}
echo '' >> ~/.bashrc && echo "export RMW_IMPLEMENTATION=${rmw_implementation}" >> ~/.bashrc
安装pacmod
wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/galactic/amd64.env && source /tmp/amd64.env
sudo apt install apt-transport-https
sudo sh -c 'echo "deb [trusted=yes] https://s3.amazonaws.com/autonomoustuff-repo/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/autonomoustuff-public.list'
sudo apt update
sudo apt install ros-${rosdistro}-pacmod3
安装autoware_core
pip3 install gdown
安装autoware universe dependencies
sudo apt install geographiclib-tools
sudo geographiclib-get-geoids egm2008-1
安装pre_commit
clang_format_version=14.0.6
pip3 install pre-commit clang-format==${clang_format_version}
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt install golang
安装CUDA
查看amd64.env,可以看到推荐的CUDA版本为12.3,在https://developer.nvidia.com/cuda-toolkit 官网中选择版本,为了避免因为CUDA版本太高,cuDNN、TensorRT无法使用,故下载CUDA12.0
网页中选择好CUDA版本安装deb方式安装:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-0
设置环境变量
export PATH=/usr/local/cuda-12.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-12.0/lib64:$LD_LIBRARY_PATH
检查CUDA版本:
nvcc --version
安装cuDNN
在官网https://developer.nvidia.com/rdp/cudnn-archive 下载好cuDNN v8.9.5 for CUDA12.X后,解压文件
tar -xvf cudnn-linux-x86_64-8.9.5.30_cuda12-archive.tar.xz
将解压后的头文件和库复制到cuda目录中:
cd cudnn-linux-x86_64-8.9.5.30_cuda12-archive/
sudo cp include/cudnn* /usr/local/cuda/include
sudo cp lib/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn* /usr/local/cuda/lib64/libcudnn*
cuDNN安装完成,查看安装的版本:
cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
安装TensorRT
在官网https://developer.nvidia.com/nvidia-tensorrt-8x-download选择TensorRT 8.6进行下载后解压:
sudo dpkg -i nv-tensorrt-*.deb
配置环境变量:将TensorRT的库路径添加到LD_LIBRARY_PATH中,编辑~/.bashrc文件并添加以下内容:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu/
重启终端:保存~/.bashrc文件并执行以下命令使配置生效:
source ~/.bashrc
安装完成后,您可以通过运行以下命令验证TensorRT是否已成功安装:
dpkg -l | grep TensorRT
下载 Autoware artifacts
cd autoware/
ansible-galaxy collection install -f -r "ansible-galaxy-requirements.yaml"
ansible-playbook autoware.dev_env.download_artifacts -e "data_dir=$HOME/autoware_data" --ask-become-pass
编译源码
克隆存储库:
cd autoware
mkdir src
vcs import src < autoware.repos
安装依赖的 ROS 包
sudo rosdep init
sudo rosdep update
rosdepc install
source /opt/ros/humble/setup.bash
rosdepc install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
编译:
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
单独编译某个包:
colcon build --packages-up-to <name-of-pkg>
清理并重新构建:有时候构建过程中的残留文件可能会导致问题。尝试清理以前的构建文件并重新构建项目:
rm -rf build install log
colcon clean
编译报错
/home/buaa/TensorRT-8.6.1.6/include/NvInferRuntime.h:674:61: error: unused parameter ‘pluginFactory’ [-Werror=unused-parameter]
674 | void const blob, std::size_t size, IPluginFactory pluginFactory) noexcept
|~~~~^~~~~
cc1plus: all warnings being treated as errors
gmake[2]: [CMakeFiles/tensorrt_common.dir/build.make:76: CMakeFiles/tensorrt_common.dir/src/tensorrt_common.cpp.o] Error 1
gmake[1]: [CMakeFiles/Makefile2:137: CMakeFiles/tensorrt_common.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
这个错误主要是由于编译器将所有警告都视为错误,而NvInferRuntime.h中的一个未使用的参数pluginFactory触发了这个警告
解决方法:忽略未使用参数的警告
找到包含tensorrt_common包的CMakeLists.txt文件:
find . -name "CMakeLists.txt" | grep tensorrt_common
终端输出:
./src/universe/autoware.universe/common/tensorrt_common/CMakeLists.txt
修改CMakeLists.txt文件,在CMakeLists.txt文件中添加以下行,忽略未使用参数的警告:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-parameter")
出现警告
CMake Warning at CMakeLists.txt:20 (message):
cuda, cudnn, tensorrt libraries are not found
解决方法 设置环境变量:
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
编译警告1:
--- stderr: elevation_map_loader
CMake Warning at CMakeLists.txt:16 (find_package):
By not providing "Findrosbag2_storage_sqlite3.cmake" in CMAKE_MODULE_PATH
this project has asked CMake to find a package configuration file provided
by "rosbag2_storage_sqlite3", but CMake did not find one.
Could not find a package configuration file provided by
"rosbag2_storage_sqlite3" with any of the following names:
rosbag2_storage_sqlite3Config.cmake
rosbag2_storage_sqlite3-config.cmake
Add the installation prefix of "rosbag2_storage_sqlite3" to
CMAKE_PREFIX_PATH or set "rosbag2_storage_sqlite3_DIR" to a directory
containing one of the above files. If "rosbag2_storage_sqlite3" provides a
separate development package or SDK, be sure it has been installed.解决办法:安装对应的包
sudo apt-get install ros-$ROS_DISTRO-rosbag2-storage*
编译警告2:
--- stderr: yabloc_pose_initializer
CMake Warning (dev) at CMakeLists.txt:12 (find_package):
Policy CMP0074 is not set: find_package uses _ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
CMake variable PCL_ROOT is set to:
/usr
For compatibility, CMake is ignoring the variable.
This warning is for project developers. Use -Wno-dev to suppress it.
解决办法:安装对应的包
CMP0074未设置,而在项目中使用了find_package命令,该命令使用了PCL_ROOT变量。
在对应的包的project()命令之后,find_package()命令之前,添加
cmake_policy(SET CMP0074 NEW)
使用以下命令来查找功能包所在的位置,例如要寻找上面报错的yabloc_pose_initializer包的位置:
colcon list | grep yabloc_pose_initializer
然后单独编译这个包:
colcon build --packages-up-to yabloc_pose_initializer
编译警告3
--- stderr: bag_time_manager_rviz_plugin
CMake Warning (dev) at CMakeLists.txt:7 (find_package):
Ignoring EXACT since no version is requested.
This warning is for project developers. Use -Wno-dev to suppress it.
解决办法:
没安装QT5或者没在~/.bashrc中指明QT5的位置,查询QT5是否安装,若安装则或打印出安装位置:
qmake --version
终端输出:
QMake version 3.1
Using Qt version 5.15.3 in /usr/lib/x86_64-linux-gnu
故在~/.bashrc添加:
export PATH="/usr/lib/x86_64-linux-gnu/qt5/bin:$PATH"
export LD_LIBRARY_PATH="/usr/lib/x86_64-linux-gnu/qt5/lib:$LD_LIBRARY_PATH"
安装Autoware Build GUI
安装依赖:
sudo apt install libwebkit2gtk-4.1-0 libjavascriptcoregtk-4.1-0 libsoup-3.0-0 libsoup-3.0-common
安装Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh
sudo apt install rustc
验证:
rustc --version
安装Node.js:
sudo apt install nodejs
验证 Node.js 安装
node --version
安装npm
npm install -g pnpm
下载源码:
git clone https://github.com/leo-drive/autoware-build-gui.git
安装.deb
sudo dpkg -i autoware-build-gui_1.0.3_amd64.deb
下载好高精地图后就可运行案例
source install/setup.bash
ros2 launch autoware_launch planning_simulator.launch.xml map_path:=autoware_map/sample-map-planning vehicle_model:=sample_vehicle sensor_model:=sample_sensor_kit
评论