diff --git a/README.md b/README.md index e2a60b1..94f6038 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,162 @@ roslaunch wild_visual_navigation_jackal wild_visual_navigation.launch [![IEEE](https://img.shields.io/badge/IEEE-10468651-blue?logo=IEEE)](https://ieeexplore.ieee.org/document/10468651) [![GitHub](https://img.shields.io/badge/GitHub-Repository-lightgrey?logo=github)](https://github.com/Ikhyeon-Cho/LeSTA) + +# LeSTA with Gazebo Simulation Setup + +This guide walks you through building and launching the LeSTA with Gazebo simulation environment using Docker. + +--- + +## 1. Clone the Repository + +```bash +cd lesta_sim +``` + +--- + +## 2. Docker Setup + +### 2.1. Make entrypoint scripts executable: + +```bash +cd Docker +chmod +x lesta_entrypoint.sh +cd .. +``` + +--- + +### 2.2. Build and run the container + +**Before running**, edit the `volumes` section in `docker-compose.yaml` to match your absolute project path. + +You can get the full path using: + +```bash +pwd +``` + +**Example `volumes` section:** + +```yaml +volumes: + - /home/yourname/path/to/lesta_sim:/workspace/docker_root +``` + +Make sure the first path points to your current directory (`lesta_sim`). + +Then: + +```bash +cd Docker +``` + +- For Docker Compose v1: + ```bash + docker-compose up --build + ``` + +- For Docker Compose v2: + ```bash + docker compose up --build + ``` + +--- + +## 3. Start the container (if it was stopped): + +```bash +docker start lesta +docker attach lesta +``` + +--- + +## 4. CMake Fix Required for building LeSTA + +Before building the workspace, edit: + +``` +/workspace/docker_root/lesta_ws/src/LeSTA/lesta_ros/CMakeLists.txt +``` + +Move the following block **above all other `find_package(...)` calls**: + +```cmake +find_package(catkin REQUIRED COMPONENTS + height_mapping_core + roscpp + tf2_ros + pcl_conversions + grid_map_ros + message_generation +) +``` + +--- + +## 5. Build the Workspace + +```bash +cd /workspace/docker_root/lesta_ws +catkin build lesta +source devel/setup.bash +``` + +--- + +## 6. Install pylesta Package + +```bash +cd /workspace/docker_root/lesta_ws/src/LeSTA +pip install -e pylesta +``` + +--- + +## 7. Gazebo Simulation + +### 7.1. Make Gazebo entrypoints executable: + +```bash +cd /workspace/docker_root/Docker +chmod +x gazebo_entrypoint_1.sh gazebo_entrypoint_2.sh +``` + + + +### 7.2. Run the Git clone & environment setup: + +```bash +./gazebo_entrypoint_1.sh +``` + +> ⚠️ **TODO:** You must edit the workspace directory and `GAZEBO_MODEL_PATH` inside: +> `/workspace/docker_root/gazebo_ws/src/husky/setup/first_run.sh` + + + +### 7.3. After editing: + +> [OPTIONAL] edit the custom world path inside gazebo_entrypoint_2.sh and uncomment lines before running: +```bash +cd /workspace/docker_root/Docker && ./gazebo_entrypoint_2.sh +``` +--- +## 8. Run +If you have completed all the steps above, +you can refer to the following project pages for execution commands: + +- LeSTA: https://github.com/Ikhyeon-Cho/LeSTA.git + +- Husky: https://github.com/dongjineee/husky.git + +Simply follow the instructions provided on each project page to run the system. + +--- +
Gaussian Process-Based Traversability Analysis for Terrain Mapless Navigation diff --git a/lesta_sim/Docker/Dockerfile b/lesta_sim/Docker/Dockerfile new file mode 100644 index 0000000..dab6e00 --- /dev/null +++ b/lesta_sim/Docker/Dockerfile @@ -0,0 +1,107 @@ +FROM annazabnus/ros-cuda:11.8-noetic + +ARG DEBIAN_FRONTEND=noninteractive +ARG ROS_DISTRO=noetic +ENV ROS_DISTRO=${ROS_DISTRO} + +# Curl +RUN apt-get update && apt-get install -y curl +RUN curl -I https://raw.githubusercontent.com + +# install ros packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + "ros-noetic-desktop-full=1.5.0-1*" \ + && rm -rf /var/lib/apt/lists/* + +# install bootstrap tools +RUN apt-get update && apt-get install --no-install-recommends -y \ + build-essential \ + python3-rosdep \ + python3-rosinstall \ + python3-vcstools \ + && rm -rf /var/lib/apt/lists/* + +# bootstrap rosdep +RUN rm -rf /etc/ros/rosdep/sources.list.d/20-default.list && rosdep init && \ + rosdep update --rosdistro $ROS_DISTRO + +# install ros packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + ros-noetic-ros-base=1.5.0-1* \ + && rm -rf /var/lib/apt/lists/* + +# Install commonly-used development tools. +RUN apt-get update && apt-get install --yes \ + build-essential \ + clang-12 \ + clang-format-12 \ + cmake \ + g++ \ + gdb \ + git \ + nano \ + valgrind \ + vim + +# Install commonly-used Python tools. +RUN apt-get update && apt-get install --yes \ + python-is-python3 \ + python3-catkin-tools \ + python3-pip + +# Install commonly-used command-line tools. +RUN apt-get update && apt-get install --yes \ + curl \ + iproute2 \ + iputils-ping \ + less \ + mesa-utils \ + net-tools \ + rsync \ + software-properties-common \ + sudo \ + tmux \ + tree \ + unzip \ + usbutils \ + wget \ + zip \ + zsh + +RUN apt-get update && apt-get install ros-noetic-grid-map -y + +# Fix networkx compatibility for Python 3.8 before installing PyTorch +RUN pip install 'networkx<3.0' + +# Pytorch +RUN pip install torch==2.2.2 torchvision==0.17.2 torchaudio==2.2.2 --index-url https://download.pytorch.org/whl/cu118 + +# Install LibTorch (2.6.0 + CUDA 11.8) +RUN wget https://download.pytorch.org/libtorch/cu118/libtorch-cxx11-abi-shared-with-deps-2.6.0%2Bcu118.zip && \ + unzip libtorch-cxx11-abi-shared-with-deps-2.6.0+cu118.zip && \ + rm libtorch-cxx11-abi-shared-with-deps-2.6.0+cu118.zip && \ + mv libtorch /opt/libtorch +ENV TORCH_DIR=/libtorch/share/cmake/Torch +ENV LIBTORCH /opt/libtorch +ENV LD_LIBRARY_PATH /opt/libtorch/lib:$LD_LIBRARY_PATH + +ENV CMAKE_PREFIX_PATH="/libtorch/share/cmake/Torch:${CMAKE_PREFIX_PATH}" + +# Install simulation dependency +RUN apt update && apt install -y \ + ros-noetic-ros-controllers \ + ros-noetic-fath-pivot-mount-description \ + ros-noetic-flir-camera-description \ + ros-noetic-velodyne-description \ + ros-noetic-realsense2-description \ + ros-noetic-lms1xx \ + ros-noetic-robot-localization \ + ros-noetic-interactive-marker-twist-server \ + ros-noetic-twist-mux \ + ros-noetic-teleop-twist-keyboard \ + ros-noetic-teleop-twist-joy \ + ros-noetic-rviz-imu-plugin \ + ros-noetic-gmapping \ + python3-catkin-tools && \ + apt clean && rm -rf /var/lib/apt/lists/* + diff --git a/lesta_sim/Docker/docker-compose-gui-nvidia.yaml b/lesta_sim/Docker/docker-compose-gui-nvidia.yaml new file mode 100644 index 0000000..f8e1e81 --- /dev/null +++ b/lesta_sim/Docker/docker-compose-gui-nvidia.yaml @@ -0,0 +1,10 @@ +services: + lesta: + extends: + file: docker-compose-gui.yaml + service: lesta + environment: + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=all + - LIBGL_ALWAYS_INDIRECT=0 + runtime: nvidia diff --git a/lesta_sim/Docker/docker-compose-gui.yaml b/lesta_sim/Docker/docker-compose-gui.yaml new file mode 100644 index 0000000..78f7371 --- /dev/null +++ b/lesta_sim/Docker/docker-compose-gui.yaml @@ -0,0 +1,13 @@ +services: + lesta: + extends: + file: docker-compose.yaml + service: lesta + environment: + - DISPLAY=${DISPLAY} + - QT_X11_NO_MITSHM=1 + deploy: + resources: + reservations: + devices: + - capabilities: [gpu] diff --git a/lesta_sim/Docker/docker-compose.yaml b/lesta_sim/Docker/docker-compose.yaml new file mode 100644 index 0000000..227263f --- /dev/null +++ b/lesta_sim/Docker/docker-compose.yaml @@ -0,0 +1,21 @@ +version: "3.9" + +services: + lesta: + build: + context: . + dockerfile: Dockerfile + image: lesta + container_name: lesta + privileged: true + network_mode: host + volumes: + - /home/miiiiiryeong/traversability_application/lesta_sim:/workspace/docker_root + - /dev/dri:/dev/dri + - /tmp/.X11-unix:/tmp/.X11-unix + - /tmp/.docker.xauth:/tmp/.docker.xauth:rw + - /usr/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:ro + - /usr/lib/x86_64-linux-gnu/libGL.so.1:/usr/lib/x86_64-linux-gnu/libGL.so.1:ro + stdin_open: true + tty: true + entrypoint: ["/workspace/docker_root/Docker/lesta_entrypoint.sh"] diff --git a/lesta_sim/Docker/gazebo_entrypoint_1.sh b/lesta_sim/Docker/gazebo_entrypoint_1.sh new file mode 100755 index 0000000..34b5132 --- /dev/null +++ b/lesta_sim/Docker/gazebo_entrypoint_1.sh @@ -0,0 +1,6 @@ +GAZEBO_WS="/workspace/docker_root/gazebo_ws" +if [ ! -d "$GAZEBO_WS/src/husky" ]; then + mkdir -p $GAZEBO_WS/src + cd $GAZEBO_WS/src + git clone https://github.com/dongjineee/husky.git +fi diff --git a/lesta_sim/Docker/gazebo_entrypoint_2.sh b/lesta_sim/Docker/gazebo_entrypoint_2.sh new file mode 100755 index 0000000..32574de --- /dev/null +++ b/lesta_sim/Docker/gazebo_entrypoint_2.sh @@ -0,0 +1,29 @@ +# TODO: You have to edit workspace directory and GAZEBO_MODEL_PATH in /workspace/docker_root/gazebo_ws/src/husky/setup/first_run.sh + +GAZEBO_WS="/workspace/docker_root/gazebo_ws" +cd $GAZEBO_WS/src/husky/setup +source first_run.sh + +# [Optional] Prepare moon world + GAZEBO_MAPS_DIR="$GAZEBO_WS/src/husky/husky_gazebo/gazebo_maps" + mkdir -p $GAZEBO_MAPS_DIR + +# [Optional] Copy moon world + if [ -d "/workspace/docker_root/moon" ]; then + cp -r /workspace/docker_root/moon "$GAZEBO_MAPS_DIR/" + fi + +cd $GAZEBO_WS/src +if [ ! -d "velodyne_simulator" ]; then + git clone https://github.com/lmark1/velodyne_simulator.git +fi + +if [ ! -d "hector_gazebo" ]; then + git clone https://github.com/tu-darmstadt-ros-pkg/hector_gazebo.git +fi + +source /opt/ros/noetic/setup.bash + +if [ -f "$GAZEBO_WS/devel/setup.bash" ]; then + source "$GAZEBO_WS/devel/setup.bash" +fi diff --git a/lesta_sim/Docker/lesta_entrypoint.sh b/lesta_sim/Docker/lesta_entrypoint.sh new file mode 100755 index 0000000..01aafad --- /dev/null +++ b/lesta_sim/Docker/lesta_entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +source /opt/ros/noetic/setup.bash + +WS_PATH="/workspace/docker_root/lesta_ws" +mkdir -p $WS_PATH + +if [ ! -d "$WS_PATH/src" ]; then + mkdir -p $WS_PATH/src + cd $WS_PATH/src + git clone https://github.com/Ikhyeon-Cho/LeSTA.git +fi + +echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc +echo "export ROS_WORKSPACE=$WS_PATH" >> ~/.bashrc +echo "export ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH:$WS_PATH/src" >> ~/.bashrc + +exec /bin/bash