Ubuntu18.04にAutoware.AIをインストール

Ubuntu18.04にAutoware.AIをインストールしてROSBAG Demoの実行をします。

# 目次
1. [Autoware.AIのインストールとROSBAG Demoの実行](https://qiita.com/k-koh/items/90647b1cb140b4b75c91)

# 動作環境
- MacBookPro A1708 (Core i7, 16GB RAM, 512GB SSD)
- Ubuntu 18.04
- ROS Melodic
- Qt Creator 4.9.2
- Autoware 1.14.0

# Autoware.AIのソースからインストール

基本的に公式の[ソースからインストール](https://gitlab.com/autowarefoundation/autoware.ai/autoware/-/wikis/Source-Build)手順参考します。


- System dependencies for Ubuntu 18.04 / Melodic

```
$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
$ sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
$ sudo apt update
$ sudo apt install git
$ sudo apt install -y python-catkin-pkg python-rosdep ros-melodic-catkin
$ sudo apt install -y python3-pip python3-colcon-common-extensions python3-setuptools python3-vcstool
$ pip3 install -U setuptools

```

- ソースのコンパイル

```
$ mkdir -p autoware.ai/src
$ cd autoware.ai
$ wget -O autoware.ai.repos "https://gitlab.com/autowarefoundation/autoware.ai/autoware/raw/1.14.0/autoware.ai.repos?inline=false"
$ vcs import src < autoware.ai.repos
$ sudo rosdep init
$ rosdep update
$ rosdep install -y --from-paths src --ignore-src --rosdistro melodic
$ source /opt/ros/melodic/setup.bash

# With CUDA support
$ AUTOWARE_COMPILE_WITH_CUDA=1 colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

# Without CUDA Support
$ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
```

# Autoware ROSBAG Demoを実行

公式の[ROSBAG Demo](https://gitlab.com/autowarefoundation/autoware.ai/autoware/-/wikis/ROSBAG-Demo)手順を参考したですが、最新Autoware 1.14.0ソースで公式の「Video steps」通りにならないので、
[TIER IV ACADEMY自動運転システム構築塾](http://4c281b16296b2ab02a4e0b2e3f75446d.cdnext.stream.ne.jp/randc/mirai/3_Autoware_LP.pdf)　を参考しました。


- Download Demo data

```
$ cd ~
$ mkdir .autoware
$ cd .autoware
$ wget https://autoware-ai.s3.us-east-2.amazonaws.com/sample_moriyama_data.tar.gz
$ wget https://autoware-ai.s3.us-east-2.amazonaws.com/sample_moriyama_150324.tar.gz
$ tar zxfv sample_moriyama_150324.tar.gz
$ tar zxfv sample_moriyama_data.tar.gz
```

- Autowareを起動

```
$ roslaunch runtime_manager runtime_manager.launch
```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/da67fcea-25b1-f78e-051f-cc5ed59b2ca2.png)


- Load sample ROSBAG data

Simulation tabで「.autoware/sample_moriyama_150324.bag」 を選択

Set the start time to 140, then click Play and Pause just after it has started playing

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/edee9e37-b4d4-de1a-ec68-7ac6884faeda.png)


- Launch RViz

```
1. Launch RViz through the RViz button
2. Load default.rviz(File -> Open Config)
autoware/documentation/autoware_quickstart_examples/config/default.rviz
```

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/fb447e46-b6d8-59cd-d279-5826b84b4c76.png)

- Setup tabでTFとVehicle Modelを設定

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/07b47d29-379f-d24c-8090-9c4088edf7d6.png)

- Map tabでPoint CloudをロードとTF設定

Point CloudのRefより「.autoware/data/map/pointcloud_map」 に遷移

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/fca3190f-fb12-6774-c556-93fcdeb64e03.png)

pcdファイルを全選択してOpen

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/82f82324-fd9f-9e31-ea4c-ee7349ad357e.png)

Point CloudとTFを選択して設定

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/0585a578-df72-3953-c2cc-acd43771fd2e.png)

- Sensing tabでvoxel_grid_filterを選択

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/fb4cf8e3-4b3d-25f0-dfab-486632488b7b.png)


- Computing tabでnmea2tfpose と ndt_matching を選択

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/ba0ddee2-99c2-0d15-b060-3a519e08026f.png)


- Simulation tabで一時PauseしたRosbagを解除

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/179ef674-f053-c41f-8c96-fe6215444a41.png)

- RvizでVehicle ModelとSensingが表示される

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/6ca49fb0-1d5f-d1dc-b994-ab8764f5f155.png)

- RvizでPoints Mapを表示

「Points Map」のチェックボックスを一度外してから付けるとPoints Mapが表示されます。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/d4de9bfd-2a71-6034-cfb3-5aa9d2c2d00f.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/386259/de1b57f1-0c0d-300f-e195-d469b80d1c15.png)

### Video steps

[![run autoware(version: 1.14.0) demo data](http://img.youtube.com/vi/7S7uevzHIE0/0.jpg)](http://www.youtube.com/watch?v=7S7uevzHIE0)