@@ -9,7 +9,10 @@ ARG RECIPES_TAG=main
99ARG ROBOT_PACKAGES=""
1010ARG ADDITIONAL_PACKAGES=""
1111
12-
12+ # ROS2 DDS Configuration arguments (ADD THESE NEW ARGS)
13+ ARG ROS_DDS_VENDOR=cyclonedds
14+ ARG ROS_IP=localhost
15+ ARG SETUP_ROS2_DDS=true
1316
1417# env
1518ENV PYTHONUNBUFFERED=1
@@ -24,7 +27,6 @@ RUN sudo apt-get update && sudo apt-get install -y curl && \
2427
2528RUN sudo apt update && sudo apt install -y xbot2_desktop_full ros-$ROS_DISTRO-realsense2-description
2629
27-
2830# add kyon user
2931USER root
3032
@@ -53,6 +55,31 @@ ENV HHCM_FOREST_CLONE_DEFAULT_PROTO=https
5355# pip deps
5456RUN source ~/env/bin/activate && pip install netifaces
5557
58+ # ============ ADD ROS2 DDS CONFIGURATION HERE ============
59+ # ROS2 DDS Configuration (for all robots using ROS2)
60+ # Install cmake if not already present (might be needed for ros2_config)
61+ RUN if [ "$SETUP_ROS2_DDS" = "true" ]; then \
62+ sudo apt-get update && sudo apt-get install -y cmake build-essential; \
63+ fi
64+
65+ # Conditionally setup ROS2 DDS configuration
66+ RUN if [ "$SETUP_ROS2_DDS" = "true" ]; then \
67+ git clone https://github.com/advrhumanoids/ros2_config.git /tmp/ros2_config && \
68+ cd /tmp/ros2_config && \
69+ mkdir build && cd build && \
70+ cmake .. -DROS2_IP=$ROS_IP && \
71+ make && \
72+ sudo make install && \
73+ echo "source ~/ros2_config/dds/${ROS_DDS_VENDOR}/setup.bash" >> ~/.bashrc && \
74+ cd / && rm -rf /tmp/ros2_config; \
75+ fi
76+
77+ # Also set the RMW implementation if using CycloneDDS
78+ RUN if [ "$ROS_DDS_VENDOR" = "cyclonedds" ]; then \
79+ echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc; \
80+ fi
81+ # ============ END ROS2 DDS CONFIGURATION ============
82+
5683# build required software (requires valid netrc for auth)
5784# FIX 2: Activate env before running build script
5885RUN --mount=type=secret,id=netrc,dst=/home/$USER_NAME/.netrc,uid=$USER_ID \
0 commit comments