LoginSignup
6
2

ubuntu22.04 ROS 2 Humble環境にAutoware Universeをインストールする手順(Source installation)

Last updated at Posted at 2023-04-16

ubuntu22.04 ROS 2 Humble環境にSource installationの手順で依存パッケージを手動インストールする手順
ほぼドキュメントの通り

環境

OS
Ubuntu 22.04
ROS
ROS 2 Humble

必要な依存パッケージ

  1. ROS 2
  2. ROS 2 Dev Tools
  3. RMW Implementation
  4. pacmod
  5. Autoware Core dependencies
  6. Autoware Universe dependencies
  7. pre-commit dependencies
  8. Nvidia CUDA
  9. Nvidia cuDNN and TensorRT

依存関係をAnsibleのスクリプトで自動インストールする

初めて環境構築する場合はこちらを推奨

git clone https://github.com/autowarefoundation/autoware.git
cd autoware
./setup-dev-env.sh

依存関係を手動でインストールする

1. ROS2 のインストール

公式ドキュメントや参考記事を参考にインストールする

公式ドキュメント

参考記事

2. ROS 2 Dev Toolsのインストール

sudo apt update && sudo apt install -y \
  python3-flake8-docstrings \
  python3-pip \
  python3-pytest-cov \
  ros-dev-tools

sudo apt install -y \
  python3-flake8-blind-except \
  python3-flake8-builtins \
  python3-flake8-class-newline \
  python3-flake8-comprehensions \
  python3-flake8-deprecated \
  python3-flake8-import-order \
  python3-flake8-quotes \
  python3-pytest-repeat \
  python3-pytest-rerunfailures

sudo rosdep init
rosdep update

3. RMW Implementationのインストール

wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env

# For details: https://docs.ros.org/en/humble/How-To-Guides/Working-with-multiple-RMW-implementations.html
sudo apt update
rmw_implementation_dashed=$(eval sed -e "s/_/-/g" <<< "${rmw_implementation}")
sudo apt install ros-${rosdistro}-${rmw_implementation_dashed}

# (Optional) You set the default RMW implementation in the ~/.bashrc file.
echo '' >> ~/.bashrc && echo "export RMW_IMPLEMENTATION=${rmw_implementation}" >> ~/.bashrc

4. pacmodのインストール

wget -O /tmp/amd64.env https://raw.githubusercontent.com/autowarefoundation/autoware/main/amd64.env && source /tmp/amd64.env

# Taken from https://github.com/astuff/pacmod3#installation
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

5. autoware_coreの依存パッケージをインストール

pip3 install gdown

6. autoware_universeの依存パッケージをインストール

sudo apt install geographiclib-tools

# Add EGM2008 geoid grid to geographiclib
sudo geographiclib-get-geoids egm2008-1

7. pre_commiteの依存パッケージをインストール

clang_format_version=16.0.0
pip3 install pre-commit clang-format==${clang_format_version}

sudo apt install golang

8. Nvidia CUDAのインストール

9. Nvidia cuDNN と TensorRTのインストール

CUDA、cuDNN、TenserRTのインストールは省略

Autowareのclone

git clone https://github.com/autowarefoundation/autoware.git
cd autoware

ワークスペースの設定

ディレクトリを作成してwstoolsでワークスペースを構築

cd autoware
mkdir src
vcs import src < autoware.repos

依存するROS 2 パッケージのインストール

source /opt/ros/humble/setup.bash
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO

ROS 2 パッケージのビルド

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release

CPUのみで動かす場合 CUDAに依存しているパッケージのbuildを飛ばす

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-skip traffic_light_classifier bytetrack lidar_apollo_instance_segmentation lidar_centerpoint tensorrt_yolox traffic_light_fine_detector

メモリが足りなくてcolcon buildが失敗する場合の対処方法

・MAKEFLAGSを-j1に設定

 MAKEFLAGS=-j1

・--parallel-workersオプションで同時にbuildするパッケージ数を1にする(colcon のデフォルトは4)

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
 --parallel-workers 1

・メモリのSWAP領域を増やす

ドキュメントのトラブルシューティング

参考

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2