Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: RAI dockerfiles #377

Merged
merged 9 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ The RAI framework aims to:
## Table of Contents

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

## Setup
## Setup (docker)

Currently, docker images are experimental. See the [docker](docs/setup_docker.md) for instructions.

## Setup (local)

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

Expand Down
43 changes: 43 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright (C) 2024 Robotec.AI
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

ARG ROS_DISTRO=jazzy

FROM osrf/ros:${ROS_DISTRO}-desktop-full
ENV DEBIAN_FRONTEND=noninteractive

# Install dependencies
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
git \
wget

# Install Poetry
RUN curl -sSL https://install.python-poetry.org | python3 - --version 1.8.4
ENV PATH="/root/.local/bin:$PATH"

# Clone and setup RAI
WORKDIR /rai
RUN git clone https://github.com/RobotecAI/rai.git .

# Install Python dependencies with Poetry
RUN poetry install --with nomad,openset

# Install ROS dependencies
RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash && \
rosdep install --from-paths src --ignore-src -r -y'

# Build the workspace
RUN /bin/bash -c '. /opt/ros/${ROS_DISTRO}/setup.bash && colcon build --symlink-install'
47 changes: 47 additions & 0 deletions docs/setup_docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Setup RAI with docker

> [!IMPORTANT]
> Docker images are experimental. For tested setup, see the [local setup](../README.md#setup-local).

## 1. Build the docker image

Choose the docker image based on your preferred ROS 2 version.

### 1.1. Humble

```bash
docker build -t rai:humble --build-arg ROS_DISTRO=humble -f docker/Dockerfile .
```

### 1.2. Jazzy

```bash
docker build -t rai:jazzy --build-arg ROS_DISTRO=jazzy -f docker/Dockerfile .
```

## 2. Run the docker container

> [!TIP]
> If you intend to run demos on the host machine, ensure the docker container can communicate with it.
> 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).
> 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.

### 2.1. Humble

```bash
docker run --net=host --ipc=host --pid=host -it -v $(pwd):/rai rai:humble
```

### 2.2. Jazzy

```bash
docker run --net=host --ipc=host --pid=host -it -v $(pwd):/rai rai:jazzy
```

## 3. Run the tests to confirm the setup

```sh
cd /rai
source setup_shell.sh
poetry run pytest
```