# Copyright (c) Contributors to the Open 3D Engine Project. # For complete copyright and license terms please see the LICENSE at the root of this distribution. # # SPDX-License-Identifier: Apache-2.0 OR MIT # ARG ROS_VERSION=humble ARG UBUNTU_VERSION=jammy FROM ros:${ROS_VERSION}-ros-base-${UBUNTU_VERSION} ENV WORKSPACE=/data/workspace WORKDIR $WORKSPACE # ROSConDemo Variables ARG ROSCON_DEMO_REPO=https://github.com/o3de/ROSConDemo.git ARG ROSCON_DEMO_BRANCH=main ARG ROSCON_DEMO_COMMIT=HEAD ENV ROSCON_DEMO_ROOT=$WORKSPACE/ROSConDemo ENV ROSCON_DEMO_NAV_ROOT=$WORKSPACE/kraken_nav ENV LANG=en_US.UTF-8 # Setup time zone and locale data (necessary for SSL and HTTPS packages) RUN apt-get update \ && DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata locales keyboard-configuration curl \ && sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ && dpkg-reconfigure --frontend=noninteractive locales \ && update-locale LANG=en_US.UTF-8 \ && sh -c 'echo "deb [arch=amd64,arm64] http://repo.ros2.org/ubuntu/main `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list' \ && curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - \ && rm -rf /var/lib/apt/lists/* # Install the required ubuntu packages RUN apt-get update \ && apt-get install -y \ python3 \ python3-pip \ git \ git-lfs \ software-properties-common \ ros-${ROS_DISTRO}-ackermann-msgs \ ros-${ROS_DISTRO}-control-toolbox \ ros-${ROS_DISTRO}-gazebo-msgs \ ros-${ROS_DISTRO}-joy \ ros-${ROS_DISTRO}-navigation2 \ ros-${ROS_DISTRO}-rviz2 \ ros-${ROS_DISTRO}-tf2-ros \ ros-${ROS_DISTRO}-urdfdom \ ros-${ROS_DISTRO}-vision-msgs \ ros-${ROS_DISTRO}-cyclonedds \ ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \ ros-${ROS_DISTRO}-slam-toolbox \ ros-${ROS_DISTRO}-nav2-bringup \ ros-${ROS_DISTRO}-pointcloud-to-laserscan \ ros-${ROS_DISTRO}-teleop-twist-keyboard \ ros-${ROS_DISTRO}-topic-tools \ python3-colcon-common-extensions \ && rm -rf /var/lib/apt/lists/* \ && pip install python-statemachine ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp # Clone and build the navstack project RUN . /opt/ros/${ROS_DISTRO}/setup.sh \ ############################################################### \ # Clone the ROSConDemo \ ############################################################### \ && git clone --single-branch -b $ROSCON_DEMO_BRANCH $ROSCON_DEMO_REPO $ROSCON_DEMO_ROOT \ && git -C $ROSCON_DEMO_ROOT lfs install \ && git -C $ROSCON_DEMO_ROOT lfs pull \ && git -C $ROSCON_DEMO_ROOT reset --hard $ROSCON_DEMO_COMMIT \ && mv $ROSCON_DEMO_ROOT/kraken_nav $ROSCON_DEMO_NAV_ROOT \ && rm -rf $ROSCON_DEMO_ROOT # Build the navigation stack RUN . /opt/ros/${ROS_DISTRO}/setup.sh \ && cd $ROSCON_DEMO_NAV_ROOT \ && colcon build --symlink-install # Add the appropriate ros2 environment setup script to the system startup RUN echo "[Unit]" > /etc/systemd/system/setup_ros.service \ && echo "After=network.target" >> /etc/systemd/system/setup_ros.service \ && echo "" >> /etc/systemd/system/setup_ros.service \ && echo "[Service]" >> /etc/systemd/system/setup_ros.service \ && if [ "${ROS_DISTRO}" = "iron" ]; then \ echo "ExecStart=/opt/ros/iron/setup.bash" >> /etc/systemd/system/setup_ros.service; \ elif [ "${ROS_DISTRO}" = "humble" ]; then \ echo "ExecStart=/opt/ros/humble/setup.bash" >> /etc/systemd/system/setup_ros.service; \ elif [ "${ROS_DISTRO}" = "galactic" ]; then \ echo "ExecStart=/opt/ros/galactic/setup.bash" >> /etc/systemd/system/setup_ros.service; \ fi \ && echo "" >> /etc/systemd/system/setup_ros.service \ && echo "[Install]" >> /etc/systemd/system/setup_ros.service \ && echo "WantedBy=default.target" >> /etc/systemd/system/setup_ros.service \ && echo "" >> /etc/systemd/system/setup_ros.service ENV NVIDIA_VISIBLE_DEVICES all ENV NVIDIA_DRIVER_CAPABILITIES all