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

Support usage of rmw_zenoh #34

Merged
merged 8 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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 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 && \
lreiher marked this conversation as resolved.
Show resolved Hide resolved
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