Skip to content

Commit 27df532

Browse files
author
Thomas McCarty-Gibson
committed
Made modifications for adding zenoh, see readme.md
1 parent 64a6f0d commit 27df532

File tree

251 files changed

+13757
-120
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+13757
-120
lines changed

.devcontainer.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
"target": "dev",
66
"context": ".",
77
"args": {
8-
"ROS_DISTRO": "kilted",
8+
"ROS_DISTRO": "kilted"
99
}
1010
},
1111
"workspaceFolder": "/workspace",
1212
"workspaceMount": "source=${localWorkspaceFolder},target=/workspace,type=bind",
1313
"mounts": [],
1414
"runArgs": [
15-
"--net=host"
15+
"--net=host",
16+
"--env-file",
17+
"${localWorkspaceFolder}/.env" // Adjust path as needed
1618
],
1719
"containerEnv": {
1820
"SHELL": "/bin/bash"
1921
}
20-
}
22+
}

.env

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Name of this project:
2+
REPO_NAME = ros2-container-template
3+
4+
#ROS Configuration
5+
ROS_DOMAIN_ID=0
6+
ROS_DISTRO=jazzy
7+
CYCLONEDDS_URI=/cyclonedds.xml
8+
RMW_IMPLEMENTATION=rmw_zenoh_cpp
9+
ZENOH_ROUTER_CONFIG_URI=/CUSTOM_RMW_ZENOH_ROUTER_CONFIG.json5
10+
ZENOH_SESSION_CONFIG_URI=/CUSTOM_RMW_ZENOH_SESSION_CONFIG.json5
11+
12+
# Registry Configuration
13+
CACHE = ${REG}/${REPO_NAME}
14+
CACHE_AMD64 = ${CACHE}:cache-amd64
15+
CACHE_ARM64 = ${CACHE}:cache-arm64
16+
REG=example.registry.com
17+
18+
# Docker configuration
19+
CONTAINERFILE = Containerfile
20+
CONTAINER_ENGINE = docker
21+
COMPOSEFILE = docker-compose.yml
22+
23+
# Tag names
24+
# These are dependent on the distro, meaning changing distro will cause a rebuild
25+
BASE_TAG = ${ROS_DISTRO}-base
26+
DEV_TAG = ${ROS_DISTRO}-dev
27+
FINAL_TAG = ${ROS_DISTRO}-final
28+
TAG=${FINAL_TAG}
29+
30+
# Image names
31+
BASE_IMAGE = ${REPO_NAME}:${BASE_TAG}
32+
DEV_IMAGE = ${REPO_NAME}:${DEV_TAG}
33+
FINAL_IMAGE = ${REPO_NAME}:${FINAL_TAG}
34+
35+
# Marker files
36+
# These are used by `build`, `test`, `dev`, and `final` commands
37+
# to ensure rebuilds only happen when necessary
38+
MARKER_DIR = .make-markers
39+
BASE_BUILT = ${MARKER_DIR}/base.built
40+
DEV_BUILT = ${MARKER_DIR}/dev.built
41+
FINAL_BUILT = ${MARKER_DIR}/final.built

.github/workflows/makefile.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
!Containerfile
88
!.devcontainer.json
99
!README.md
10-
10+
!docker-compose.yaml
11+
!.env
12+
!/root/
13+
!/root/** */
1114
!/container/
1215
!/container/**
1316
!/linux/

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[submodule "src/examples"]
2-
path = src/examples
1+
[submodule "src/example"]
2+
path = src/example
33
url = https://github.com/ros2/examples.git
4-
branch = kilted
4+
branch = jazzy

Containerfile

Lines changed: 84 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
ARG ROS_DISTRO
1+
# Set up ROS2 container for diesl, and configure Zenoh for the RMW
2+
ARG ROS_DISTRO=jazzy TAG=latest REG=registry.gitlab.sitcore.net/haiisw/diesl
3+
4+
5+
6+
###########################################################################
7+
### BASE IMAGE ###
8+
###########################################################################
29

310
# The base layer only installs dependencies, and does not build any code
411
# It installs a full ros environment
5-
FROM docker.io/osrf/ros:${ROS_DISTRO}-desktop-full AS base
612

7-
ENV DEBIAN_FRONTEND=noninteractive
13+
# You can either user the diesl base image or the official ROS base image
14+
# FROM ${REG}:diesl-base:${TAG} AS base
15+
FROM ros:${ROS_DISTRO}-ros-base AS base
16+
17+
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 OPAL_PREFIX= ROS_DISTRO=${ROS_DISTRO}
818

919
# Install packages
1020
RUN apt-get update \
@@ -15,32 +25,44 @@ RUN apt-get update \
1525
git \
1626
python3-pip \
1727
pip \
18-
python3-rosdep \
28+
python3-rosdep \
29+
wget \
30+
unzip \
1931
ros-${ROS_DISTRO}-ros-gz \
2032
ros-${ROS_DISTRO}-launch \
2133
ros-${ROS_DISTRO}-launch-ros \
2234
ros-${ROS_DISTRO}-ament-cmake \
2335
ros-${ROS_DISTRO}-ament-cmake-core \
24-
ros-${ROS_DISTRO}-ament-cmake-python
25-
# TODO add your dependencies here!
36+
ros-${ROS_DISTRO}-ament-cmake-python \
37+
# alternative RMW packages:
38+
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
39+
ros-${ROS_DISTRO}-rmw-zenoh-cpp \
40+
# Add additional depencies here as needed, these are for the example
41+
ros-jazzy-example-interfaces \
42+
ros-jazzy-demo-nodes-cpp \
43+
python3-pytest \
44+
python3-numpy
45+
46+
ENV RMW_IMPLEMENTATION=rmw_zenoh_cpp ZENOH_ROUTER_CONFIG_URI=/CUSTOM_RMW_ZENOH_ROUTER_CONFIG.json5 ZENOH_SESSION_CONFIG_URI=/CUSTOM_RMW_ZENOH_SESSION_CONFIG.json5
47+
# expose ports used for Zenoh
48+
EXPOSE 7447/tcp
49+
EXPOSE 8000/tcp
50+
EXPOSE 7447/udp
51+
EXPOSE 7446/udp
52+
53+
COPY root/ /
2654

27-
# Set up the entrypoint
28-
RUN cat <<EOF > /entrypoint.bash
29-
#!/usr/bin/env bash
30-
source /opt/ros/${ROS_DISTRO}/setup.bash
55+
RUN chmod +x /entrypoint.bash
56+
ENTRYPOINT [ "/entrypoint.bash" ]
3157

32-
if [ -f /workspace/install/setup.bash ]; then
33-
source /workspace/install/setup.bash
34-
fi
58+
STOPSIGNAL SIGINT
3559

36-
exec "\$@"
37-
exec bash
38-
EOF
3960

40-
RUN chmod +x /entrypoint.bash
41-
ENTRYPOINT [ "/entrypoint.bash" ]
61+
###########################################################################
62+
### BUILD IMAGE ###
63+
###########################################################################
4264

43-
# The build layer (which should probably be renamed), actually builds everything.
65+
# Full image with all the functionality, built on top of the base image
4466
FROM base AS build
4567

4668
# Copy in workspace
@@ -50,19 +72,54 @@ WORKDIR /workspace
5072
# Actually build package
5173
RUN . /opt/ros/${ROS_DISTRO}/setup.sh && colcon build
5274

53-
# Start from mininal image for final
54-
FROM docker.io/library/ros:${ROS_DISTRO}-ros-core AS final
75+
STOPSIGNAL SIGINT
76+
77+
###########################################################################
78+
### FINAL IMAGE ###
79+
###########################################################################
5580

56-
# TODO uncomment this and add runtime dependencies
57-
# RUN apt-get update \
58-
# && apt-get install -y --no-install-recommends \
59-
# my-package
60-
# && rm -rf /var/lib/apt/lists/*
81+
# Stripped down image with only what is needed to run the code
82+
FROM ros:${ROS_DISTRO}-ros-core AS final
83+
84+
RUN apt-get update \
85+
&& apt-get install -y --no-install-recommends \
86+
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
87+
ros-${ROS_DISTRO}-rmw-zenoh-cpp \
88+
# Add additional depencies here as needed, these are examples
89+
ros-jazzy-example-interfaces \
90+
ros-jazzy-demo-nodes-cpp \
91+
python3-pytest \
92+
python3-numpy \
93+
# and clean up apt cache
94+
&& apt-get autoclean \
95+
&& rm -rf /var/lib/apt/lists/*
6196

6297
COPY --from=build /workspace/build /workspace/build
6398
COPY --from=build /workspace/install /workspace/install
6499

65-
CMD [ "bash" ] # TODO your command here!!
100+
ENV DEBIAN_FRONTEND=noninteractive LANG=C.UTF-8 LC_ALL=C.UTF-8 OPAL_PREFIX=
101+
ENV RMW_IMPLEMENTATION=rmw_zenoh_cpp ZENOH_ROUTER_CONFIG_URI=/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5 ZENOH_SESSION_CONFIG_URI=/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5
102+
# expose ports used for Zenoh
103+
EXPOSE 7447/tcp
104+
EXPOSE 8000/tcp
105+
EXPOSE 7447/udp
106+
EXPOSE 7446/udp
107+
108+
COPY root/ /
109+
110+
RUN chmod +x /entrypoint.bash
111+
ENTRYPOINT [ "/entrypoint.bash" ]
112+
113+
# Example of run command, in this case startng a zenoh router node
114+
# CMD ["ros2", "run", "rmw_zenoh_cpp", "rmw_zenohd"]
115+
116+
STOPSIGNAL SIGINT
117+
118+
119+
120+
###########################################################################
121+
### DEV IMAGE ###
122+
###########################################################################
66123

67124
# Dev environment with useful tools
68125
FROM base AS dev

0 commit comments

Comments
 (0)