Skip to content

Commit 9322016

Browse files
feat: RAI dockerfiles (#377)
Co-authored-by: Bartek Boczek <[email protected]>
1 parent c6c49b9 commit 9322016

File tree

3 files changed

+97
-2
lines changed

3 files changed

+97
-2
lines changed

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ The RAI framework aims to:
4747
## Table of Contents
4848

4949
- [Features](#features)
50-
- [Setup](#setup)
50+
- [Setup (docker)](#setup-docker)
51+
- [Setup (local)](#setup)
5152
- [Usage examples (demos)](#simulation-demos)
5253
- [Debugging Assistant](#debugging-assistant)
5354
- [Developer resources](#developer-resources)
@@ -71,7 +72,11 @@ The RAI framework aims to:
7172
- [ ] SDK for RAI developers.
7273
- [ ] UI for configuration to select features and tools relevant for your deployment.
7374

74-
## Setup
75+
## Setup (docker)
76+
77+
Currently, docker images are experimental. See the [docker](docs/setup_docker.md) for instructions.
78+
79+
## Setup (local)
7580

7681
Before going further, make sure you have ROS 2 (Jazzy or Humble) installed and sourced on your system.
7782

docker/Dockerfile

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright (C) 2024 Robotec.AI
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
ARG ROS_DISTRO=jazzy
16+
17+
FROM osrf/ros:${ROS_DISTRO}-desktop-full
18+
ENV DEBIAN_FRONTEND=noninteractive
19+
20+
# Install dependencies
21+
RUN apt-get update && apt-get install -y \
22+
python3 \
23+
python3-pip \
24+
git \
25+
wget
26+
27+
# Install Poetry
28+
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.4
29+
ENV PATH="/root/.local/bin:$PATH"
30+
31+
# Clone and setup RAI
32+
WORKDIR /rai
33+
RUN git clone https://github.com/RobotecAI/rai.git .
34+
35+
# Install Python dependencies with Poetry
36+
RUN poetry install --with nomad,openset
37+
38+
# Install ROS dependencies
39+
RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash && \
40+
rosdep install --from-paths src --ignore-src -r -y'
41+
42+
# Build the workspace
43+
RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash && colcon build --symlink-install'

docs/setup_docker.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Setup RAI with docker
2+
3+
> [!IMPORTANT]
4+
> Docker images are experimental. For tested setup, see the [local setup](../README.md#setup-local).
5+
6+
## 1. Build the docker image
7+
8+
Choose the docker image based on your preferred ROS 2 version.
9+
10+
### 1.1. Humble
11+
12+
```bash
13+
docker build -t rai:humble --build-arg ROS_DISTRO=humble -f docker/Dockerfile .
14+
```
15+
16+
### 1.2. Jazzy
17+
18+
```bash
19+
docker build -t rai:jazzy --build-arg ROS_DISTRO=jazzy -f docker/Dockerfile .
20+
```
21+
22+
## 2. Run the docker container
23+
24+
> [!TIP]
25+
> If you intend to run demos on the host machine, ensure the docker container can communicate with it.
26+
> Test this by running the standard ROS 2 example with one node in docker and one on the host: [link](https://docs.ros.org/en/jazzy/Installation/Ubuntu-Install-Debs.html#try-some-examples).
27+
> If topics are not visible or cannot be subscribed to, try using [rmw_cyclone_dds](https://github.com/ros2/rmw_cyclonedds) instead of the default rmw_fastrtps_cpp.
28+
29+
### 2.1. Humble
30+
31+
```bash
32+
docker run --net=host --ipc=host --pid=host -it -v $(pwd):/rai rai:humble
33+
```
34+
35+
### 2.2. Jazzy
36+
37+
```bash
38+
docker run --net=host --ipc=host --pid=host -it -v $(pwd):/rai rai:jazzy
39+
```
40+
41+
## 3. Run the tests to confirm the setup
42+
43+
```sh
44+
cd /rai
45+
source setup_shell.sh
46+
poetry run pytest
47+
```

0 commit comments

Comments
 (0)