Skip to content
Open
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
49 changes: 49 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
ARG ROS_DISTRO=noetic

FROM osrf/ros:${ROS_DISTRO}-desktop-full as deps

ENV DEBIAN_FRONTEND=noninteractive
ENV ROS_PYTHON_VERSION=3

SHELL ["/bin/bash", "-c"]

RUN apt-get update && apt-get install -y \
python3-rosdep \
python3-catkin-tools \
build-essential \
libyaml-cpp-dev \
ros-${ROS_DISTRO}-ompl \
ros-${ROS_DISTRO}-grid-map-core \
ros-${ROS_DISTRO}-grid-map-ros \
ros-${ROS_DISTRO}-grid-map-msgs \
ros-${ROS_DISTRO}-geometry-msgs \
ros-${ROS_DISTRO}-visualization-msgs \
ros-${ROS_DISTRO}-std-msgs \
ros-${ROS_DISTRO}-dynamic-reconfigure \
ros-${ROS_DISTRO}-tf \
ros-${ROS_DISTRO}-tf2 \
ros-${ROS_DISTRO}-tf2-ros \
ros-${ROS_DISTRO}-urdf \
ros-${ROS_DISTRO}-eigen-conversions \
ros-${ROS_DISTRO}-rviz \
ros-${ROS_DISTRO}-fake-localization \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /root/catkin_ws

RUN mkdir -p src
COPY . /root/catkin_ws/src/se2_navigation

FROM deps as builder

ARG CMAKE_BUILD_TYPE=Release

WORKDIR /root/catkin_ws

RUN source /opt/ros/${ROS_DISTRO}/setup.bash && \
catkin config --extend /opt/ros/${ROS_DISTRO} --cmake-args -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} && \
catkin build

RUN echo "source /root/catkin_ws/devel/setup.bash" >> /root/.bashrc

CMD ["bash"]
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.PHONY: docker-build docker-shell compose-build compose-up compose-down

IMAGE ?= se2_navigation:noetic
SERVICE ?= car_demo

docker-build:
docker build --build-arg ROS_DISTRO=noetic -t $(IMAGE) .

docker-shell:
xhost +local:root || true
docker run --rm -it \
-e DISPLAY=$$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
-e ROS_MASTER_URI=http://127.0.0.1:11311 \
-e ROS_IP=127.0.0.1 \
--network host \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
--device /dev/dri \
--shm-size 1g \
$(IMAGE) \
bash

compose-build:
docker compose build $(SERVICE)

compose-up:
xhost +local:root || true
docker compose up $(SERVICE)

compose-down:
docker compose down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ Refer to [car_demo](car_demo/README.md) for the details.
Refer to [approach_pose_planner](se2_approach_pose_planning/approach_pose_planner_ros/README.md) if you are interested
in approach pose planning.

## Docker Setup

The repository includes a ROS Noetic `Dockerfile`, a `docker-compose.yml`, and Makefile shortcuts for desktop testing.

- **Prerequisites**: Docker with the Compose plugin, GPU drivers/X11 if you plan to visualize RViz or Gazebo. Allow the container to access your X server with `xhost +` before launching.
- **Build image**: `make docker-build` (sets up the catkin workspace inside the container).
- **Open interactive shell**: `make docker-shell` enters the image with ROS sourced; you can run commands such as `roslaunch car_demo demo_autonomous.launch`.
- **Run the demo via Compose**: `make compose-up` builds (if needed) and launches the `car_demo` service defined in `docker-compose.yml`.
- **Stop containers**: `make compose-down` tears down the Compose stack and keeps the catkin workspace volume.

## Usage

Run the main demo with:
Expand Down
28 changes: 28 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "3.9"

services:
car_demo:
build:
context: .
dockerfile: Dockerfile
args:
ROS_DISTRO: noetic
command: ["/bin/bash", "-lc", "source /root/catkin_ws/devel/setup.bash && roslaunch car_demo demo_autonomous.launch"]
environment:
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- ROS_MASTER_URI=http://127.0.0.1:11311
- ROS_IP=127.0.0.1
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
network_mode: host
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- car_demo_workspace:/root/catkin_ws
devices:
- /dev/dri:/dev/dri
shm_size: 1g
restart: "no"

volumes:
car_demo_workspace: