Skip to content

Commit

Permalink
Merge pull request #34 from ika-rwth-aachen/rmw-zenoh
Browse files Browse the repository at this point in the history
Support usage of `rmw_zenoh`
  • Loading branch information
jpbusch authored Oct 25, 2024
2 parents 842047d + c6d4087 commit 4921850
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ The password of the custom user is set to its username (`dockeruser:dockeruser`
- **`rmw-implementation` | `RMW_IMPLEMENTATION`**
ROS 2 middleware implementation
*default:* `rmw_cyclonedds_cpp`
*supported values:* `rmw_fastrtps_cpp`, `rmw_cyclonedds_cpp`, `rmw_gurumdds_cpp`, ...
*supported values:* `rmw_zenoh_cpp`, `rmw_fastrtps_cpp`, `rmw_cyclonedds_cpp`, `rmw_gurumdds_cpp`, ...
- **`ros-distro` | `ROS_DISTRO`**
ROS Distro
*required if ROS is not installed in `base-image`*
Expand Down
25 changes: 19 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ARG BASE_IMAGE

############ dependencies ######################################################
FROM ${BASE_IMAGE} as dependencies
FROM ${BASE_IMAGE} AS dependencies

USER root
SHELL ["/bin/bash", "-c"]
Expand Down Expand Up @@ -214,7 +214,19 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
ARG RMW_IMPLEMENTATION="rmw_cyclonedds_cpp"
ENV RMW_IMPLEMENTATION=${RMW_IMPLEMENTATION}
RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
if [[ "$ROS_VERSION" == "2" ]]; then \
if [[ "$RMW_IMPLEMENTATION" == "rmw_zenoh_cpp" ]]; then \
mkdir -p /opt/ws_rmw_zenoh/src && \
git clone https://github.com/ros2/rmw_zenoh.git /opt/ws_rmw_zenoh/src/rmw_zenoh && \
rosdep init || true && \
rosdep update --rosdistro $ROS_DISTRO && \
apt-get update && \
cd /opt/ws_rmw_zenoh && \
rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO && \
rm -rf /var/lib/apt/lists/* && \
source /opt/ros/${ROS_DISTRO}/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release && \
echo "source /opt/ws_rmw_zenoh/install/setup.bash" >> ~/.bashrc ; \
elif [[ "$ROS_VERSION" == "2" ]]; then \
apt-get update && \
RMW_PACKAGE=ros-$ROS_DISTRO-$(echo $RMW_IMPLEMENTATION | tr '_' '-') && \
apt-get install -y $RMW_PACKAGE && \
Expand All @@ -225,34 +237,35 @@ RUN source /opt/ros/$ROS_DISTRO/setup.bash && \
RUN echo "source /opt/ros/$ROS_DISTRO/setup.bash" >> ~/.bashrc
# set entrypoint
ENV TINI_VERSION v0.19.0
ENV TINI_VERSION=v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-${TARGETARCH} /tini
RUN chmod +x /tini
COPY docker/docker-ros/docker/entrypoint.sh /
ENTRYPOINT ["/tini", "--", "/entrypoint.sh"]
############ dev ###############################################################
FROM dependencies-install as dev
FROM dependencies-install AS dev
# copy contents of repository from dependencies stage
COPY --from=dependencies $WORKSPACE/src $WORKSPACE/src
CMD ["bash"]
############ build #############################################################
FROM dev as build
FROM dev AS build
# build ROS workspace
RUN if [[ -x "$(command -v colcon)" ]]; then \
source /opt/ros/${ROS_DISTRO}/setup.bash && \
[[ -f /opt/ws_rmw_zenoh/install/setup.bash ]] && source /opt/ws_rmw_zenoh/install/setup.bash ; \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release ; \
elif [[ -x "$(command -v catkin)" ]]; then \
catkin config --install --extend /opt/ros/${ROS_DISTRO} && \
catkin build -DCMAKE_BUILD_TYPE=Release --force-color --no-status --summarize ; \
fi
############ run ###############################################################
FROM dependencies-install as run
FROM dependencies-install AS run
# copy ROS install space from build stage
COPY --from=build $WORKSPACE/install install
Expand Down
1 change: 1 addition & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -e

# source ROS workspace
source /opt/ros/$ROS_DISTRO/setup.bash
[[ -f /opt/ws_rmw_zenoh/install/setup.bash ]] && source /opt/ws_rmw_zenoh/install/setup.bash
[[ -f $WORKSPACE/devel/setup.bash ]] && source $WORKSPACE/devel/setup.bash
[[ -f $WORKSPACE/install/setup.bash ]] && source $WORKSPACE/install/setup.bash

Expand Down

0 comments on commit 4921850

Please sign in to comment.