-
Notifications
You must be signed in to change notification settings - Fork 667
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add files to run autoware.proj on a Docker container (#215)
Co-authored-by: Kenji Miyake <kenji.miyake@tier4.jp>
- Loading branch information
1 parent
ec9f1ea
commit a30aacb
Showing
6 changed files
with
127 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM ubuntu:20.04 | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
## Install APT packages | ||
# hadolint ignore=DL3008 | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
ansible \ | ||
curl \ | ||
git \ | ||
gnupg \ | ||
lsb-release \ | ||
python3-pip \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
## Install vcstool | ||
# hadolint ignore=DL3008 | ||
RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \ | ||
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null \ | ||
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3-vcstool \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
## Setup build environment in a temporary directory | ||
# hadolint ignore=DL3003 | ||
RUN --mount=type=ssh \ | ||
mkdir -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts \ | ||
&& git clone git@github.com:tier4/autoware.proj.git -b main /tmp/autoware.proj \ | ||
&& cd /tmp/autoware.proj \ | ||
&& mkdir src \ | ||
&& vcs import src < autoware.proj.repos \ | ||
&& ./setup_ubuntu20.04.sh -c \ | ||
&& rm -rf /tmp/autoware.proj \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM autoware:base | ||
# SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
## Copy autoware.proj.repos to the workspace | ||
COPY autoware.proj.repos /autoware/autoware.proj.repos | ||
WORKDIR /autoware | ||
|
||
## Build | ||
# hadolint ignore=DL3003,SC1091 | ||
RUN --mount=type=ssh \ | ||
mkdir src \ | ||
&& vcs import src < autoware.proj.repos \ | ||
&& source /opt/ros/galactic/setup.bash \ | ||
&& colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release | ||
|
||
## Create entrypoint | ||
COPY docker/entrypoint.sh / | ||
ENTRYPOINT [ "/entrypoint.sh" ] | ||
CMD ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Dockerfile for autoware.proj | ||
|
||
This directory contains files to run autoware.proj on Docker. | ||
|
||
## Build | ||
|
||
Just run `build.sh` in this directory. This takes some time. | ||
|
||
```sh | ||
./docker/build.sh | ||
``` | ||
|
||
## Run | ||
|
||
### Prerequisites | ||
|
||
- [rocker](https://github.com/osrf/rocker) | ||
|
||
To enable GUI applications on Docker Containers, this script uses `rocker`. | ||
Please see [here](http://wiki.ros.org/docker/Tutorials/GUI) for more details. | ||
|
||
```sh | ||
sudo apt-get install python3-rocker | ||
``` | ||
|
||
### Examples | ||
|
||
#### How to do a rosbag Simulation | ||
|
||
```sh | ||
# Build your docker image | ||
cd ~/ | ||
git clone git@github.com:tier4/autoware.proj.git | ||
~/autoware.proj/docker/build.sh | ||
|
||
# Create and move to a workspace | ||
mkdir ~/rosbag_simulation | ||
cd ~/rosbag_simulation | ||
|
||
# Download a sample map | ||
gdown --id 1ovrJcFS5CZ2H51D8xVWNtEvj_oiXW-zk | ||
unzip rosbag_sample_map.zip -d map | ||
|
||
# Download a sample rosbag file | ||
mkdir sample | ||
cd sample | ||
gdown --id 1wLWyOlfH_-k4VYBgae1KAFlKdwJnH_si | ||
|
||
# Accept X-access from localhost | ||
xhost +local: | ||
|
||
# Run Autoware in the simulation mode | ||
rocker --nvidia --x11 --user --volume ~/rosbag_simulation -- autoware:pre-built | ||
ros2 launch autoware_launch logging_simulator.launch.xml map_path:=$HOME/rosbag_simulation/map vehicle_model:=lexus sensor_model:=aip_xx1 | ||
|
||
# Play the sample rosbag file in another terminal | ||
rocker --nvidia --x11 --user --volume ~/rosbag_simulation -- autoware:pre-built | ||
ros2 bag play ~/rosbag_simulation/sample/sample.625-2.bag2_0.db3 -r 0.2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(readlink -f "$(dirname "$0")") | ||
|
||
AUTOWARE_PROJ_ROOT="$SCRIPT_DIR/../" | ||
DOCKER_BUILDKIT=1 docker build -t autoware:base --ssh default -f "$SCRIPT_DIR/Dockerfile.base" "$AUTOWARE_PROJ_ROOT" | ||
DOCKER_BUILDKIT=1 docker build -t autoware:pre-built --ssh default -f "$SCRIPT_DIR/Dockerfile.pre-built" "$AUTOWARE_PROJ_ROOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC1091 | ||
source /autoware/install/setup.bash | ||
exec "$@" |