2022年8月6日 星期六

筆記: 在 Windows11 WSL2 安裝 Autoware

1. 平台為 Windows 11

安裝 WSL2 步驟如官網連結

https://ubuntu.com/tutorials/install-ubuntu-on-wsl2-on-windows-11-with-gui-support#2-install-wsl

選擇 Ubuntu 20.04.4 LTS


2. 安裝 GUI package

sudo apt install x11-apps

驗證用  xcalc, 若出現計算機表示成功。



3. 安裝 Docker

 安裝 Docker (不使用 docker-desktop)

參考

curl -fsSL https://get.docker.com -o get-docker.sh

sudo sh get-docker.sh

sudo service docker start



4. 安裝CUDA Toolkit


sudo apt-key del 7fa2af80

wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin

sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600

wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb

sudo dpkg -i cuda-repo-wsl-ubuntu-11-7-local_11.7.0-1_amd64.deb

sudo apt-get update

sudo apt-get -y install cuda

若出現:

Err:1 file:/var/cuda-repo-wsl-ubuntu-11-7-local  InRelease

  The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BCD50790B81839D3

解法:

 sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/*.gpg /usr/share/keyrings/


若出現:

The public CUDA GPG key does not appear to be installed. To install the key, run this command: sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-B81839D3-keyring.gpg /usr/share/keyrings/

解法:

sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-B81839D3-keyring.gpg /usr/share/keyrings/

sudo mv /usr/share/keyrings/cuda-archive-keyring.gpg  /usr/share/keyrings/cuda-archive-keyring.gpg.bak

sudo cp /var/cuda-repo-wsl-ubuntu-11-7-local/cuda-B81839D3-keyring.gpg    /usr/share/keyrings/cuda-archive-keyring.gpg

若出現:

W: GPG error: http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A4B469963BF863CC

E: The repository 'http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease' is not signed.

解法:

sudo rm /etc/apt/sources.list.d/cuda.list

sudo rm /etc/apt/sources.list.d/nvidia-ml.list

sudo apt-key del 7fa2af80

sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub

sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64/7fa2af80.pub




安裝 nvidia-docker2


 distribution=$(. /etc/os-release;echo $ID$VERSION_ID)  && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -  && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list


 sudo apt update

 sudo apt install -y nvidia-docker2

 sudo service docker stop

 sudo service docker start

 sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi

若出現 NVIDIA-SMI info 表示成功



5. 在 Ubuntu 下安裝 Autowave 環境

可參考 ted99tw 文章


a. 安裝build工具

sudo apt update

sudo apt upgrade

sudo apt install build-essential


b. 安裝ADE

cd ~

mkdir adehome

cd adehome

wget https://gitlab.com/ApexAI/ade-cli/uploads/f6c47dc34cffbe90ca197e00098bdd3f/ade+x86_64

mv ade+x86_64 ade

chmod +x ade

sudo mv ade /usr/local/bin

which ade

sudo ade update-cli

ade --version

cd ~/adehome

touch .adehome


c. 安裝Autoware.auto

git clone --recurse-submodules https://gitlab.com/autowarefoundation/autoware.auto/AutowareAuto.git


新增ADE啟動檔 .aderc-nvidia

cd AutowareAuto

vim .aderc-nvidia //並儲存

export ADE_DOCKER_RUN_ARGS="--cap-add=SYS_PTRACE --net=host --privileged --add-host ade:127.0.0.1  --expose=9090 -p 9090:9090 -v ${HOME}/.Xauthority:${HOME}/.Xauthority:ro -e XAUTHORITY=${HOME}/.Xauthority -e RMW_IMPLEMENTATION=rmw_cyclonedds_cpp --runtime=nvidia -v /dev/shm:/dev/shm -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -e NVIDIA_VISIBLE_DEVICES=all -e NVIDIA_DRIVER_CAPABILITIES=compute,utility,display"

export ADE_GITLAB=gitlab.com

export ADE_REGISTRY=registry.gitlab.com

export ADE_DISABLE_NVIDIA_DOCKER=false

export ADE_IMAGES="

  registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/ade-foxy:master

  registry.gitlab.com/autowarefoundation/autoware.auto/autowareauto/amd64/binary-foxy:master

  registry.gitlab.com/autowarefoundation/autoware.auto/ade-lgsvl/foxy:2021.3

  nvidia/cuda:11.0.3-base-ubuntu20.04


"



f. 啟動 ADE

$ source .aderc-nvidia

$ ade start

$ ade enter


若出現:

Got permission denied while trying to connect to the Docker daemon socket...

將 User 加入 docker group:

 sudo usermod -aG docker $USER


g. ADE內編譯Autoware (in ADE)

cd AutowareAuto

vcs import < autoware.auto.$ROS_DISTRO.repos

colcon build

colcon test-result



6. 啟動AVP Demo

a. Run ROS 2 LGSVL Bridge

Check if you installed ROS 2 LGSVL Bridge.


If not, Install the ROS 2 LGSVL Bridge.


# In the ade container

source /opt/AutowareAuto/setup.bash

lgsvl_bridge



b. Run AVP Sim launch file

# In the ade container

source /opt/AutowareAuto/setup.bash

ros2 launch /opt/AutowareAuto/src/launch/autoware_demos/launch/avp_sim.launch.py




c. Run RViz2

# In the ade container

source /opt/AutowareAuto/setup.bash

rviz2 -d /opt/AutowareAuto/share/autoware_auto_launch/config/avp.rviz




沒有留言:

張貼留言