2023-10-23 09:56:41 +00:00
|
|
|
ARG ROS_DISTRO=humble
|
2023-10-23 10:02:29 +00:00
|
|
|
ARG UNDERLAY_WS=/base_ws
|
|
|
|
ARG OVERLAY_WS=/overlay_ws
|
2023-08-24 10:41:03 +00:00
|
|
|
|
2023-10-23 09:56:41 +00:00
|
|
|
########################################
|
|
|
|
# Custom ROS2 Base Image #
|
|
|
|
########################################
|
2023-10-23 09:18:48 +00:00
|
|
|
|
2023-10-23 09:56:41 +00:00
|
|
|
FROM osrf/ros:${ROS_DISTRO}-desktop as base
|
|
|
|
#ENV ROS_DISTRO=${ROS_DISTRO}
|
2023-08-24 10:41:03 +00:00
|
|
|
|
2023-10-23 09:56:41 +00:00
|
|
|
SHELL ["/bin/bash", "-c"] # change shell to bash because of better compatibility (standard shell would be sh otherwise).
|
|
|
|
|
|
|
|
# Create Colcon workspace with external dependencies
|
2023-10-23 10:17:44 +00:00
|
|
|
RUN mkdir -p /base_ws/src
|
|
|
|
WORKDIR /base_ws/src
|
2023-10-23 09:56:41 +00:00
|
|
|
COPY my.repos .
|
|
|
|
RUN mv my.repos dependencies.repos
|
|
|
|
RUN vcs import < dependencies.repos
|
|
|
|
|
|
|
|
# Build the base Colcon workspace, installing dependencies first.
|
2023-10-23 10:17:44 +00:00
|
|
|
WORKDIR /base_ws
|
2023-10-23 09:56:41 +00:00
|
|
|
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
|
|
|
|
&& apt-get update -y \
|
|
|
|
&& apt-get install -y --no-install-recommends \
|
|
|
|
ros-${ROS_DISTRO}-turtlesim \
|
2023-10-23 11:28:29 +00:00
|
|
|
ros-${ROS_DISTRO}-rqt\
|
2023-10-23 10:38:59 +00:00
|
|
|
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y
|
2023-10-23 11:28:29 +00:00
|
|
|
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
|
|
|
|
&& colcon build --symlink-install
|
2023-10-23 09:56:41 +00:00
|
|
|
|
|
|
|
# Set up the entrypoint
|
|
|
|
COPY ./docker/my_entrypoint.sh /entrypoint.sh
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
# Update repository at the end of this build stage
|
|
|
|
RUN vcs pull src
|
|
|
|
|
|
|
|
ENTRYPOINT [ "/entrypoint.sh" ]
|
2023-10-23 10:02:29 +00:00
|
|
|
|
|
|
|
|
2023-10-23 11:28:29 +00:00
|
|
|
#############################################################
|
|
|
|
# Overlay Image -- Building Unitree GO1 ROS2 implementation #
|
|
|
|
#############################################################
|
2023-10-23 10:02:29 +00:00
|
|
|
FROM base AS overlay
|
|
|
|
|
|
|
|
# Create an overlay Colcon workspace
|
2023-10-23 10:17:44 +00:00
|
|
|
RUN mkdir -p /overlay_ws/src
|
|
|
|
WORKDIR /overlay_ws/src
|
2023-10-23 10:02:29 +00:00
|
|
|
COPY my_extended.repos ./overlay.repos
|
2023-10-23 11:28:29 +00:00
|
|
|
RUN vcs import < overlay.repos \
|
|
|
|
&& cd unitree_ros2_to_real \
|
|
|
|
&& git clone -b v3.5.1 https://github.com/unitreerobotics/unitree_legged_sdk \
|
|
|
|
&& mv ros2_unitree_legged_msgs/ ..
|
|
|
|
WORKDIR /lcm_ws
|
|
|
|
RUN cd /lcm_ws \
|
|
|
|
&& git clone -b v1.4.0 https://github.com/lcm-proj/lcm \
|
|
|
|
&& cd lcm \
|
|
|
|
&& mkdir build \
|
|
|
|
&& cd build \
|
|
|
|
&& cmake ../ \
|
|
|
|
&& make \
|
|
|
|
&& make install \
|
2023-10-23 10:02:29 +00:00
|
|
|
|
2023-10-23 10:17:44 +00:00
|
|
|
WORKDIR /overlay_ws
|
2023-10-23 10:02:29 +00:00
|
|
|
|
|
|
|
ENV DEBIAN_FRONTEND noninteractive
|
|
|
|
|
2023-10-23 10:17:44 +00:00
|
|
|
RUN source /base_ws/install/setup.bash \
|
2023-10-23 10:02:29 +00:00
|
|
|
&& apt-get update \
|
|
|
|
&& DEBIAN_FRONTEND=noninteractive apt-get install \
|
2023-10-23 11:28:29 +00:00
|
|
|
nano \
|
|
|
|
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \
|
2023-10-23 10:02:29 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2023-10-23 10:17:44 +00:00
|
|
|
RUN source /base_ws/install/setup.bash \
|
2023-10-23 11:28:29 +00:00
|
|
|
&& colcon build --symlink-install
|
2023-10-23 10:02:29 +00:00
|
|
|
|
|
|
|
# Set up the entrypoint
|
|
|
|
COPY ./docker/my_entrypoint.sh /entrypoint.sh
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
# Update repository at the end of this build stage
|
|
|
|
RUN vcs pull src
|
|
|
|
|
|
|
|
ENTRYPOINT [ "/entrypoint.sh" ]
|