Skip to content
New issue

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

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

Already on GitHub? # to your account

Added Dockerfile, docker compose and entrypoint files #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion dependencies.repos
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ repositories:
industrial_calibration:
type: git
url: https://github.com/ros-industrial/industrial_calibration.git
version: 1.0.0
version: 1.0.3
ros_industrial_cmake_boilerplate:
type: git
url: https://github.com/ros-industrial/ros_industrial_cmake_boilerplate.git
Expand Down
3 changes: 3 additions & 0 deletions docker/3d_data_collection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /opt/industrial_calibration_ros2/install/setup.bash
ros2 launch industrial_calibration_ros 3d_data_collection.launch.xml
41 changes: 41 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ARG TAG=humble-desktop
FROM osrf/ros:${TAG}

ARG ROS_DISTRO

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

ENV DEBIAN_FRONTEND noninteractive

USER root

# Install
RUN apt update \
&& apt upgrade -y \
&& apt install -y cmake curl git python3 python3-pip \
&& python3 -m pip install --user open3d numpy==1.24.4

# Bind mount the source directory so as not to unnecessarily copy source code into the docker image
ARG WORKSPACE_DIR=/opt/industrial_calibration_ros2
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/industrial_calibration_ros2 \
apt update -y -qq \
&& vcs import ${WORKSPACE_DIR}/src < ${WORKSPACE_DIR}/src/industrial_calibration_ros2/dependencies.repos --shallow \
&& rosdep install \
--from-paths ${WORKSPACE_DIR}/src \
-iry

# Build the repository
# Bind mount the source directory so as not to unnecessarily copy source code into the docker image
RUN --mount=type=bind,target=${WORKSPACE_DIR}/src/industrial_calibration_ros2 \
source /opt/ros/${ROS_DISTRO}/setup.bash \
&& cd ${WORKSPACE_DIR} \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \
&& rm -rf build log

# Set the entrypoints to source the workspace and launch executables
COPY docker/data_collection.sh /data_collection.sh
COPY docker/3d_data_collection.sh /3d_data_collection.sh
COPY docker/extrinsic_calibration_gui.sh /extrinsic_calibration_gui.sh
COPY docker/intrinsic_calibration_gui.sh /intrinsic_calibration_gui.sh

ENTRYPOINT ["./data_collection.sh"]
3 changes: 3 additions & 0 deletions docker/data_collection.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /opt/industrial_calibration_ros2/install/setup.bash
ros2 launch industrial_calibration_ros data_collection.launch.xml
38 changes: 38 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
services:
industrial_calibration_ros2:
build:
context: ..
dockerfile: docker/Dockerfile
args:
TAG: humble-desktop
ROS_DISTRO: humble
environment:
DISPLAY: $DISPLAY
XAUTHORITY: $XAUTHORITY
# NVIDIA_DRIVER_CAPABILITIES: all
ROS_LOG_DIR: /tmp
container_name: industrial_calibration_ros2
image: ghcr.io/ros-industrial/industrial_calibration_ros2:humble
stdin_open: true
tty: true
network_mode: host
privileged: false
user: ${CURRENT_UID} # CURRENT_UID=$(id -u):$(id -g)
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix
- /etc/hosts:/etc/hosts
- /etc/passwd:/etc/passwd:ro
- /etc/group:/etc/group:ro

# entrypoint: './data_collection.sh'
# entrypoint: './3d_data_collection.sh'
# entrypoint: ./extrinsic_calibration_gui.sh
# entrypoint: ./intrinsic_calibration_gui.sh

# deploy:
# resources:
# reservations:
# devices:
# - driver: nvidia
# count: 1
# capabilities: [gpu]
3 changes: 3 additions & 0 deletions docker/extrinsic_calibration_gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /opt/industrial_calibration_ros2/install/setup.bash
./opt/industrial_calibration_ros2/install/industrial_calibration/bin/industrial_calibration_extrinsic_hand_eye_calibration_app
3 changes: 3 additions & 0 deletions docker/intrinsic_calibration_gui.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
source /opt/industrial_calibration_ros2/install/setup.bash
./opt/industrial_calibration_ros2/install/industrial_calibration/bin/industrial_calibration_camera_intrinsic_calibration_app