目錄
1. 基本配置情況
2. ROS2 Humble和git安裝?
2.1 ros2 humble安裝(對應ubuntu22.04,僅源碼安裝需要)
2.2 git安裝?
3. 克隆autoware代碼
?4.自動安裝依賴項(推薦)
5. 手動安裝依賴項(在一鍵配置失效下使用,這里僅列出docker安裝中需要的依賴)
?5.1 cuda安裝
?5.2 docker engine安裝
5.3??NVIDIA Container Toolkit安裝
5.4 rocker安裝
?6. 創(chuàng)建工作空間(docker安裝所需的額外步驟標紅)
1. 基本配置情況
ubuntu 版本:22.04?
autoware版本:autoware.universe? (ubuntu20.04建議docker安裝/ubuntu22.04建議源碼安裝)
?參考教程:Docker installation - Autoware Documentation (autowarefoundation.github.io)? (建議在本文的基礎上參考官網(wǎng)安裝教程,本文會指出所有安裝過程中遇到的問題,但是根據(jù)電腦硬件和網(wǎng)絡情況,還是會存在不同的問題)
注:鑒于水平有限,僅是根據(jù)官方文檔總結的安裝步驟以及一些報錯的解決思路。因為之前在ubuntu18.04和ubuntu20.04分別安裝了ai和universe版本,中間踩了比較多的坑,所以留個記錄。這次在ubuntu22.04中安裝明顯感覺報錯會少很多,因此推薦有開發(fā)和使用意向的安裝最新版的ubuntu,功能確實更加全面,也是autoware官方推薦的版本。
2. ROS2 Humble和git安裝?
2.1 ros2 humble安裝(對應ubuntu22.04,僅源碼安裝需要)
這里推薦魚香ros一鍵安裝(小魚的一鍵安裝系列 | 魚香ROS (fishros.org.cn))
wget http://fishros.com/install -O fishros && . fishros
2.2 git安裝?
sudo apt-get -y update
sudo apt-get -y install git
3. 克隆autoware代碼
# 從github中克隆代碼
git clone https://github.com/autowarefoundation/autoware.git
# 進入文件夾
cd autoware
?4.自動安裝依賴項(推薦)
1.源碼安裝
./setup-dev-env.sh
?2.docker安裝
./setup-dev-env.sh docker
5. 手動安裝依賴項(在一鍵配置失效下使用,這里僅列出docker安裝中需要的依賴)
本文按照官網(wǎng)的Docker installation for development安裝教程進行安裝,主要有以下四個依賴:
- Install Nvidia CUDA
- Install Docker Engine
- Install NVIDIA Container Toolkit
- Install rocker
?5.1 cuda安裝
官方鏈接:autoware/ansible/roles/cuda at main · autowarefoundation/autoware · GitHub
# 執(zhí)行拉取命令
wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env
# Ubuntu20.04和Ubuntu22.04都可以使用以下代碼
if [[ "$(uname -m)" == "x86_64" ]]; then
? liburcu6_url=http://archive.ubuntu.com/ubuntu
else
? liburcu6_url=http://ports.ubuntu.com/ubuntu-ports
fi
sudo echo "deb $liburcu6_url focal main restricted" > /etc/apt/sources.list.d/focal.list#?Ubuntu20.04和Ubuntu22.04都可以使用以下代碼
os=ubuntu2004
wget https://developer.download.nvidia.com/compute/cuda/repos/$os/$(uname -m)/cuda-keyring_1.0-1_all.deb
sudo dpkg -i cuda-keyring_1.0-1_all.deb
sudo apt-get update
cuda_version_dashed=$(eval sed -e "s/[.]/-/g" <<< "${cuda_version}")
sudo apt-get -y install cuda-${cuda_version_dashed}
?5.2 docker engine安裝
官方鏈接:Docker installation for quick start - Autoware Documentation
# 移除舊版本
sudo apt-get remove docker docker-engine docker.io containerd runc
# 安裝依賴
sudo apt-get updatesudo apt-get install \
? ? ca-certificates \
? ? curl \
? ? gnupg \
? ? lsb-release# 添加密鑰
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg# 安裝依賴
echo \
? "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
? $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null# 安裝 Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin# 驗證是否安裝成功
sudo docker run hello-world
# Note: This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.
5.3??NVIDIA Container Toolkit安裝
官方鏈接:autoware/ansible/roles/nvidia_docker at main · autowarefoundation/autoware · GitHub
# 安裝功能包依賴和GPG密鑰
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
? ? ? && curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - \
? ? ? && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list# 更新軟件源并安裝nvidia-docker2 軟件包
sudo apt-get update
sudo apt-get install -y nvidia-docker2# 設置運行時間并重啟docker
sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi
5.4 rocker安裝
官方鏈接:autoware/ansible/roles/rocker at main · autowarefoundation/autoware · GitHub
# 在系統(tǒng)中加入ros2依賴(出現(xiàn)報錯,見下文解決方法)
sudo apt update && sudo apt install curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg# 在sourse list中加入依賴
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null# 更新并安裝
sudo apt update
sudo apt-get install python3-rocker
出錯指令:?
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
這一步出現(xiàn)報錯?Failed to connect to raw.githubusercontent.com port 443: Connection refused
原因是被墻了,解決方法如下:
# 進入目標文件并給權限(如果不熟悉vim操作可以直接手動進入,之后在目標文件夾執(zhí)行chmod 777 hosts命令就可以了)
sudo vim /etc/hosts
# 在文本中加上一行
199.232.28.133 raw.githubusercontent.com
?報錯成功解決。
?6. 創(chuàng)建工作空間(docker安裝所需的額外步驟標紅)
創(chuàng)建?
autoware_map
?文件夾mkdir ~/autoware_map
拉取Docker(速度很慢,且有報錯,見下文解決方法)
docker pull ghcr.io/autowarefoundation/autoware-universe:latest-cuda
啟動docker
amd64構架的電腦配備NVIDIA?GPU:
rocker --nvidia --x11 --user --volume $HOME/autoware --volume $HOME/autoware_map -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
非NVIDIA?GPU或者非amd64構架:
rocker -e LIBGL_ALWAYS_SOFTWARE=1 --x11 --user --volume $HOME/autoware --volume $HOME/autoware_map -- ghcr.io/autowarefoundation/autoware-universe:latest-cuda
進入autoware文件夾:
cd autoware
創(chuàng)建src目錄并克隆依賴項(src中的文件需要梯子下載,鏈接文末提供)
mkdir src vcs import src < autoware.repos
更新依賴(存在報錯,見下文)
sudo apt update rosdep update rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
編譯(如果某個安裝包出錯可以在csdn中單獨檢索并編譯)
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
出錯指令 1:
docker pull ghcr.io/autowarefoundation/autoware-universe:latest-cuda
這一步出現(xiàn)報錯?permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post "http://%2Fvar%2Frun%2Fdocker.sock/v1.24/images/create?fromImage=ghcr.io%2Fautowarefoundation%2Fautoware-universe&tag=latest-cuda": dial unix /var/run/docker.sock: connect: permission denied,解決方法如下(Docker指令報錯的解決方法:Got permission denied while trying to connect to the Docker daemon socket at unix:/_術業(yè)還未專攻的博客-CSDN博客):
第一步:sudo gpasswd -a username docker ?#將普通用戶username加入到docker組中,username這個字段也可以直接換成$USER。
第二步:newgrp docker ?#更新docker組
第三步:再執(zhí)行你報錯的命令,此時就不會報錯了。
注意,這一步執(zhí)行非常耗時,有一個8.xGB的文件需要下載。之前在別的電腦安裝時采取過換源、換手機熱點等操作,速度有一定提升,感興趣的可以查找相關教程,這里分享一個后臺執(zhí)行命令,確保命令執(zhí)行期間不會中斷。
?# 安裝screen工具箱,執(zhí)行后臺命令
sudo apt get install screen
# 創(chuàng)建后臺端口
screen -S autoware
# 查看后臺端口
screen -ls
出錯指令 2:
rosdep update
這一步會出現(xiàn)不同類型的報錯,總的來說還是網(wǎng)絡的問題,導致無法更新,常用的解決方法在ubuntu20.04和ubuntu22.04上都失效了,最后在清華源的官網(wǎng)上找到一個解決方法
錯誤: ERROR: cannot download default sources list from: https://raw.githubusercontent.com/ros/rosdistro/ma
解決方法1(可以做嘗試,但是包括這個方法在內(nèi)的很多方法筆者都試過了,全部失效)
Ubuntu20.04 rosdep update失敗解決方法 - 知乎
解決方法2(成功)
?rosdistro | 鏡像站使用幫助 | 清華大學開源軟件鏡像站 | Tsinghua Open Source Mirror
# 手動模擬 rosdep init sudo mkdir -p /etc/ros/rosdep/sources.list.d/ sudo curl -o /etc/ros/rosdep/sources.list.d/20-default.list https://mirrors.tuna.tsinghua.edu.cn/github-raw/ros/rosdistro/master/rosdep/sources.list.d/20-default.list # 為 rosdep update 換源 export ROSDISTRO_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/rosdistro/index-v4.yaml rosdep update # 每次 rosdep update 之前,均需要增加該環(huán)境變量 # 為了持久化該設定,可以將其寫入 .bashrc 中,例如 echo 'export ROSDISTRO_INDEX_URL=https://mirrors.tuna.tsinghua.edu.cn/rosdistro/index-v4.yaml' >> ~/.bashrc
至此,autoware.universe成功安裝,后續(xù)的demo運行及相關功能的調(diào)試可繼續(xù)關注后續(xù)文章。文章來源:http://www.zghlxwxcb.cn/news/detail-800528.html
所需的一些文檔和src文件:鏈接:鏈接:? https://pan.baidu.com/s/1chKVBHtdsQEeiO-BdWR9Xw?pwd=1234 提取碼: 1234
--來自百度網(wǎng)盤超級會員v4的分享文章來源地址http://www.zghlxwxcb.cn/news/detail-800528.html
到了這里,關于【安裝教程】ubuntu20.04/22.04從零開始搭建autoware.universe的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!