2
0
Эх сурвалжийг харах

Update dockerfile scripts and separate out simulation and robot applications into separate containers

Signed-off-by: Steve Pham <[email protected]>
Steve Pham 2 жил өмнө
parent
commit
c3ff4d6d6d

+ 73 - 0
Docker/Dockerfile.robot.ubuntu-galactic

@@ -0,0 +1,73 @@
+# 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
+#
+
+
+# Example usage:
+#
+# sudo DOCKER_BUILDKIT=1 docker build -t o3de_loft_demo:latest -f Dockerfile.ubuntu-20.04 .
+#
+
+FROM ros:galactic-ros-base-focal
+ARG minimal
+ENV WORKSPACE=/data/workspace
+ENV O3DE_REPO=https://github.com/o3de/o3de.git
+ENV ROS2_GEM_REPO=https://github.com/RobotecAI/o3de-ros2-gem.git
+ENV LOFT_GEM_REPO=https://github.com/o3de/loft-arch-vis-sample.git
+ENV O3DE_DEMO_REPO=https://github.com/RobotecAI/o3de-demo-project.git
+
+WORKDIR $WORKSPACE
+
+RUN apt-get update && apt-get upgrade -y
+
+# Add additional package repositories needed for packages
+RUN apt-get install -y --no-install-recommends gpg wget curl
+
+RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null && \
+    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | tee /etc/apt/sources.list.d/kitware.list >/dev/null
+
+RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
+    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg && \
+    /bin/bash -c 'source /etc/os-release && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null'
+
+RUN apt-get update
+
+#
+# Install packages needed for cloning and building from the source repos
+#
+
+# Install the git and build tools
+RUN apt-get install -y --no-install-recommends git 
+
+# Add additional ROS2/Galactic packages
+RUN /bin/bash -c 'source /opt/ros/galactic/setup.bash && \
+                  apt install -y ros-${ROS_DISTRO}-desktop \
+                                 ros-${ROS_DISTRO}-slam-toolbox \
+                                 ros-${ROS_DISTRO}-navigation2 \
+                                 ros-${ROS_DISTRO}-nav2-bringup \
+                                 ros-${ROS_DISTRO}-pointcloud-to-laserscan \
+                                 ros-${ROS_DISTRO}-gazebo-msgs \
+                                 ros-${ROS_DISTRO}-ackermann-msgs \
+                                 ros-${ROS_DISTRO}-control-toolbox'
+
+
+# Install the O3DE-specific required packages
+RUN apt-get install -y --no-install-recommends libglu1-mesa-dev \
+                       							mesa-common-dev \
+                       							libnvidia-gl-470
+
+# Clone the demo project and register the project
+RUN cd $WORKSPACE && \
+    git clone --single-branch --branch main --recursive $O3DE_DEMO_REPO 
+
+COPY LaunchRViz.bash.ubuntu-20.04 /data/workspace/LaunchRViz.bash
+
+ENV NVIDIA_VISIBLE_DEVICES all
+ENV NVIDIA_DRIVER_CAPABILITIES all
+ 
+ENTRYPOINT ["/bin/bash", "-c"]
+
+
+

+ 1 - 3
Docker/Dockerfile.ubuntu-20.04 → Docker/Dockerfile.simulation.ubuntu-galactic

@@ -87,8 +87,7 @@ RUN cd $WORKSPACE && \
 
 # Add additional ROS2/Galactic packages
 RUN /bin/bash -c 'source /opt/ros/galactic/setup.bash && \
-                  apt install -y ros-${ROS_DISTRO}-desktop \
-                                 ros-${ROS_DISTRO}-slam-toolbox \
+                  apt install -y ros-${ROS_DISTRO}-slam-toolbox \
                                  ros-${ROS_DISTRO}-navigation2 \
                                  ros-${ROS_DISTRO}-nav2-bringup \
                                  ros-${ROS_DISTRO}-pointcloud-to-laserscan \
@@ -126,7 +125,6 @@ RUN cd $WORKSPACE/o3de-demo-project && \
 
 
 COPY LaunchClient.bash.ubuntu-20.04 /data/workspace/LaunchClient.bash
-COPY LaunchRViz.bash.ubuntu-20.04 /data/workspace/LaunchRViz.bash
 COPY delete_source.bash /data/workspace/delete_source.bash
 
 RUN if [ "$minimal" -eq "1" ]; then /bin/bash -c 'source /data/workspace/delete_source.bash'; else echo "Skipping source delete"; fi

+ 38 - 7
Docker/README.md

@@ -8,29 +8,60 @@ project simulator through the O3DE engine.
 ## Prerequisites
 
 * [Hardware requirements of o3de](https://www.o3de.org/docs/welcome-guide/requirements/)
-* At least 120 GB of free disk space
+* At least 60 GB of free disk space
 * Docker installed and configured
 * SUDO Access
 
 ## Building the Docker Image
 
-There are two Dockerfile images defined
+There are two demo simulation Dockerfile scripts defined
 
-* Dockerfile.ubuntu-20.04 (Focal / Galactic)
-* Dockerfile.ubuntu-22.04 (Jammy / Humble)
+* Dockerfile.simulation.ubuntu-galactic (Focal / Galactic)
+* Dockerfile.simulation.ubuntu-humble (Jammy / Humble)
 
-Select which docker image you would like to build and run the following command
+There are also two robot navigation stack Dockerfile scripts defined
+
+* Dockerfile.robot.ubuntu-galactic (Focal / Galactic)
+* Dockerfile.robot.ubuntu-humble (Jammy / Humble)
+
+
+Select which docker image you would like to build and run the following commands to build the client and rviz docker images
 
 ```
-sudo docker build --build-arg minimal=1  -t o3de_loft_demo:latest -f Dockerfile.ubuntu-20.04 .
+sudo docker build --build-arg minimal=1 -t o3de_loft_demo_simulation:latest -f Dockerfile.simulation.ubuntu-galactic .
+
+sudo docker build -t o3de_loft_demo_simulation:latest -f Dockerfile.robot.ubuntu-galactic .
+
 ```
 
 ```
-sudo docker build --build-arg minimal=1  -t o3de_loft_demo:latest -f Dockerfile.ubuntu-22.04 .
+sudo docker build --build-arg minimal=1 -t o3de_loft_demo_simulation:latest -f Dockerfile.simulation.ubuntu-humble .
+
+sudo docker build -t o3de_loft_demo_simulation:latest -f Dockerfile.robot.ubuntu-humble .
 ```
 
 ## Running the Docker Image
 
 
+The simulation docker image should be launched first before bringing up the robot application. To run the robot application, 
+first allow the root user to access the running X server
+
+```
+xhost +local:root
+```
+
+Then launch the built simulation docker image with the following command
 
+```
+sudo docker run --rm --network="bridge" --gpus all -e DISPLAY=:1 -v /tmp/.X11-unix:/tmp/.X11-unix -it o3de_loft_demo_simulation:latest /data/workspace/LaunchClient.bash
+
+```
+
+Once the simulation is up and running, launch the robot application docker image, which will bring up RViz to control the robot.
+
+
+```
+sudo docker run --rm --network="bridge" --gpus all -e DISPLAY=:1 -v /tmp/.X11-unix:/tmp/.X11-unix -it o3de_loft_demo_robot:latest /data/workspace/LaunchRViz.bash
+
+```