From de7024718df29eeb4917aa3370a8573e07f98984 Mon Sep 17 00:00:00 2001 From: Khalid Bourr Date: Fri, 7 Jun 2024 16:33:02 +0200 Subject: [PATCH 1/6] Add Dockerfile for ROS Noetic setup --- Dockerfile | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..340664a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# Use ROS Noetic official base image +FROM ros:noetic + +# Set frontend to noninteractive in apt-get to suppress interactive dialogs +ENV DEBIAN_FRONTEND noninteractive + +# Update and install necessary ROS packages and system dependencies +RUN apt-get update && apt-get install -y \ + ros-noetic-gazebo-ros-pkgs \ + ros-noetic-gazebo-ros-control \ + ros-noetic-rviz \ + ros-noetic-rqt-graph \ + ros-noetic-grid-map \ + ros-noetic-pcl-ros \ + ros-noetic-eigen-conversions \ + ros-noetic-tf-conversions \ + libqt5widgets5 \ + libqt5gui5 \ + libqt5core5a \ + qt5-default \ + libeigen3-dev \ + git \ + cmake \ + python3-catkin-tools \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Use bash for subsequent commands to ensure compatibility with bash-specific scripts +SHELL ["/bin/bash", "-c"] + +# Set up the catkin workspace +RUN mkdir -p /catkin_ws/src && \ + source /opt/ros/noetic/setup.bash && \ + catkin init --workspace /catkin_ws && \ + cd /catkin_ws/src + +# Clone the necessary repositories including traversability_estimation +RUN cd /catkin_ws/src && \ + git clone -b noetic https://github.com/leggedrobotics/kindr.git && \ + git clone https://github.com/leggedrobotics/elevation_mapping.git && \ + git clone https://github.com/anybotics/kindr_ros.git && \ + git clone https://github.com/leggedrobotics/any_node.git && \ + git clone https://github.com/ANYbotics/message_logger.git && \ + git clone https://github.com/leggedrobotics/traversability_estimation.git + +# Build the workspace +RUN source /opt/ros/noetic/setup.bash && \ + cd /catkin_ws && \ + catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release && \ + catkin build + +# Automatically source the workspace setup file and ROS setup for every new bash session +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc && \ + echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc + +# Reset the frontend variable to avoid affecting applications that expect interactive frontend +ENV DEBIAN_FRONTEND dialog + +CMD ["bash"] + From 3989855b6c8dbc6b0beda0c71b45716e39e2a615 Mon Sep 17 00:00:00 2001 From: Khalid Bourr Date: Fri, 7 Jun 2024 16:42:48 +0200 Subject: [PATCH 2/6] test --- start_ros_container.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 start_ros_container.sh diff --git a/start_ros_container.sh b/start_ros_container.sh new file mode 100755 index 0000000..f36185f --- /dev/null +++ b/start_ros_container.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Allowing local connections to the X server +xhost +SI:localuser:root + +# Command to run the Docker container with GPU and display settings +docker run --gpus all -it \ + --env="DISPLAY=$DISPLAY" \ + --env="XDG_RUNTIME_DIR=/tmp" \ + --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + --volume="ros-tools:/root" \ + my-custom-ros:noetic \ + /bin/bash + +# Optionally, reset the X server settings +xhost -SI:localuser:root + From 1586e135747946dea66fc118c4913d0ade625453 Mon Sep 17 00:00:00 2001 From: Khalid Bourr Date: Fri, 7 Jun 2024 16:44:53 +0200 Subject: [PATCH 3/6] remove --- Dockerfile | 60 ------------------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 340664a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,60 +0,0 @@ -# Use ROS Noetic official base image -FROM ros:noetic - -# Set frontend to noninteractive in apt-get to suppress interactive dialogs -ENV DEBIAN_FRONTEND noninteractive - -# Update and install necessary ROS packages and system dependencies -RUN apt-get update && apt-get install -y \ - ros-noetic-gazebo-ros-pkgs \ - ros-noetic-gazebo-ros-control \ - ros-noetic-rviz \ - ros-noetic-rqt-graph \ - ros-noetic-grid-map \ - ros-noetic-pcl-ros \ - ros-noetic-eigen-conversions \ - ros-noetic-tf-conversions \ - libqt5widgets5 \ - libqt5gui5 \ - libqt5core5a \ - qt5-default \ - libeigen3-dev \ - git \ - cmake \ - python3-catkin-tools \ - build-essential \ - && rm -rf /var/lib/apt/lists/* - -# Use bash for subsequent commands to ensure compatibility with bash-specific scripts -SHELL ["/bin/bash", "-c"] - -# Set up the catkin workspace -RUN mkdir -p /catkin_ws/src && \ - source /opt/ros/noetic/setup.bash && \ - catkin init --workspace /catkin_ws && \ - cd /catkin_ws/src - -# Clone the necessary repositories including traversability_estimation -RUN cd /catkin_ws/src && \ - git clone -b noetic https://github.com/leggedrobotics/kindr.git && \ - git clone https://github.com/leggedrobotics/elevation_mapping.git && \ - git clone https://github.com/anybotics/kindr_ros.git && \ - git clone https://github.com/leggedrobotics/any_node.git && \ - git clone https://github.com/ANYbotics/message_logger.git && \ - git clone https://github.com/leggedrobotics/traversability_estimation.git - -# Build the workspace -RUN source /opt/ros/noetic/setup.bash && \ - cd /catkin_ws && \ - catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release && \ - catkin build - -# Automatically source the workspace setup file and ROS setup for every new bash session -RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc && \ - echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc - -# Reset the frontend variable to avoid affecting applications that expect interactive frontend -ENV DEBIAN_FRONTEND dialog - -CMD ["bash"] - From de5ea6d5f735a005f28504c1e2815b5d5f55cda6 Mon Sep 17 00:00:00 2001 From: Khalid Bourr Date: Fri, 7 Jun 2024 16:46:46 +0200 Subject: [PATCH 4/6] Add Dockerfile for ROS Noetic setup --- Dockerfile | 60 ++++++++++++++++++++++++++++++++++++++++++ start_ros_container.sh | 17 ------------ 2 files changed, 60 insertions(+), 17 deletions(-) create mode 100644 Dockerfile delete mode 100755 start_ros_container.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..340664a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +# Use ROS Noetic official base image +FROM ros:noetic + +# Set frontend to noninteractive in apt-get to suppress interactive dialogs +ENV DEBIAN_FRONTEND noninteractive + +# Update and install necessary ROS packages and system dependencies +RUN apt-get update && apt-get install -y \ + ros-noetic-gazebo-ros-pkgs \ + ros-noetic-gazebo-ros-control \ + ros-noetic-rviz \ + ros-noetic-rqt-graph \ + ros-noetic-grid-map \ + ros-noetic-pcl-ros \ + ros-noetic-eigen-conversions \ + ros-noetic-tf-conversions \ + libqt5widgets5 \ + libqt5gui5 \ + libqt5core5a \ + qt5-default \ + libeigen3-dev \ + git \ + cmake \ + python3-catkin-tools \ + build-essential \ + && rm -rf /var/lib/apt/lists/* + +# Use bash for subsequent commands to ensure compatibility with bash-specific scripts +SHELL ["/bin/bash", "-c"] + +# Set up the catkin workspace +RUN mkdir -p /catkin_ws/src && \ + source /opt/ros/noetic/setup.bash && \ + catkin init --workspace /catkin_ws && \ + cd /catkin_ws/src + +# Clone the necessary repositories including traversability_estimation +RUN cd /catkin_ws/src && \ + git clone -b noetic https://github.com/leggedrobotics/kindr.git && \ + git clone https://github.com/leggedrobotics/elevation_mapping.git && \ + git clone https://github.com/anybotics/kindr_ros.git && \ + git clone https://github.com/leggedrobotics/any_node.git && \ + git clone https://github.com/ANYbotics/message_logger.git && \ + git clone https://github.com/leggedrobotics/traversability_estimation.git + +# Build the workspace +RUN source /opt/ros/noetic/setup.bash && \ + cd /catkin_ws && \ + catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release && \ + catkin build + +# Automatically source the workspace setup file and ROS setup for every new bash session +RUN echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc && \ + echo "source /catkin_ws/devel/setup.bash" >> ~/.bashrc + +# Reset the frontend variable to avoid affecting applications that expect interactive frontend +ENV DEBIAN_FRONTEND dialog + +CMD ["bash"] + diff --git a/start_ros_container.sh b/start_ros_container.sh deleted file mode 100755 index f36185f..0000000 --- a/start_ros_container.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Allowing local connections to the X server -xhost +SI:localuser:root - -# Command to run the Docker container with GPU and display settings -docker run --gpus all -it \ - --env="DISPLAY=$DISPLAY" \ - --env="XDG_RUNTIME_DIR=/tmp" \ - --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ - --volume="ros-tools:/root" \ - my-custom-ros:noetic \ - /bin/bash - -# Optionally, reset the X server settings -xhost -SI:localuser:root - From fd4e4aaa8fa3a3e9323ce3329ed43acef62dd234 Mon Sep 17 00:00:00 2001 From: Khalid Bourr Date: Sat, 8 Jun 2024 19:51:13 +0200 Subject: [PATCH 5/6] Add docker for ROS Noetic setup --- Dockerfile => docker/Dockerfile | 0 docker/README.md | 32 +++++++++++++++++++++++++ docker/ros_traversability_estimation.sh | 17 +++++++++++++ 3 files changed, 49 insertions(+) rename Dockerfile => docker/Dockerfile (100%) create mode 100644 docker/README.md create mode 100755 docker/ros_traversability_estimation.sh diff --git a/Dockerfile b/docker/Dockerfile similarity index 100% rename from Dockerfile rename to docker/Dockerfile diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..aafc5fa --- /dev/null +++ b/docker/README.md @@ -0,0 +1,32 @@ +# Docker Environment for Traversability Estimation + +This directory contains the Docker setup for the Traversability Estimation project, which simplifies the setup process for development and testing by encapsulating all dependencies and configurations. + +## Overview +The provided Docker configuration ensures a consistent development environment, avoiding the "works on my machine" problem, and allows for easy setup of complex dependencies involved in the project. + +## Getting Started + +### Prerequisites +- **Docker Engine**: Install Docker on your machine. See [Docker documentation](https://docs.docker.com/get-docker/) for installation instructions. +- **NVIDIA GPU Drivers**: If you are planning to use GPU capabilities, ensure that you have the appropriate NVIDIA drivers installed. Additionally, install the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-docker) for Docker to utilize GPU acceleration. + +### Building the Docker Image +Navigate to the directory containing the Dockerfile and run the following command to build the Docker image. This process can take several minutes as it installs all required dependencies and sets up the environment. + +```bash +docker build -t ros-traversability .``` + +### Running the Docker Container + +Before you can run the Docker container with GUI support, you need to ensure the environment is configured correctly for displaying GUIs from Docker to your host machine. Start by making sure the `ros_traversability_estimation.sh` script is executable: + +```bash +chmod +x ros_traversability_estimation.sh``` + +Then, execute the container using the script, which handles the necessary configurations for GPU usage and X server permissions: + +```bash +./ros_traversability_estimation.sh``` + + diff --git a/docker/ros_traversability_estimation.sh b/docker/ros_traversability_estimation.sh new file mode 100755 index 0000000..ca20b1b --- /dev/null +++ b/docker/ros_traversability_estimation.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +# Allowing local connections to the X server +xhost +SI:localuser:root + +# Command to run the Docker container with GPU and display settings +docker run --gpus all -it \ + --env="DISPLAY=$DISPLAY" \ + --env="XDG_RUNTIME_DIR=/tmp" \ + --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ + --volume="ros-tools:/root" \ + ros-traversability \ + /bin/bash + +# Optionally, reset the X server settings +xhost -SI:localuser:root + From f7978113936a561039532796c39df802ac61c6af Mon Sep 17 00:00:00 2001 From: Khalid bourr <59090819+khalidbourr@users.noreply.github.com> Date: Sun, 9 Jun 2024 15:10:21 +0200 Subject: [PATCH 6/6] Update README.md --- docker/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/README.md b/docker/README.md index aafc5fa..3c3c30b 100644 --- a/docker/README.md +++ b/docker/README.md @@ -15,18 +15,21 @@ The provided Docker configuration ensures a consistent development environment, Navigate to the directory containing the Dockerfile and run the following command to build the Docker image. This process can take several minutes as it installs all required dependencies and sets up the environment. ```bash -docker build -t ros-traversability .``` + docker build -t ros-traversability . +``` ### Running the Docker Container Before you can run the Docker container with GUI support, you need to ensure the environment is configured correctly for displaying GUIs from Docker to your host machine. Start by making sure the `ros_traversability_estimation.sh` script is executable: ```bash -chmod +x ros_traversability_estimation.sh``` +chmod +x ros_traversability_estimation.sh +``` Then, execute the container using the script, which handles the necessary configurations for GPU usage and X server permissions: ```bash -./ros_traversability_estimation.sh``` +./ros_traversability_estimation.sh +```