From 4e41c487df84a6f1fe64cacb122af6bc60c05da1 Mon Sep 17 00:00:00 2001 From: Lingzhe Zhao Date: Sun, 18 Feb 2024 23:58:12 +0800 Subject: [PATCH] Container Support (https://github.com/uzh-rpg/rpg_esim/pull/119) Squashed commit of the following: commit 5f2d23d5eab823361776234d0beb25c9187c2824 Author: ddanon <5whyk8ie@danondaddy.anonaddy.me> Date: Mon Dec 25 13:25:04 2023 -0500 remove README.md deltas for pull request commit 842562b0dc6af9cd9af27d70e018bc685cefb134 Author: ddanon <5whyk8ie@danondaddy.anonaddy.me> Date: Mon Dec 25 13:23:18 2023 -0500 clean up for pull request commit 8920b20f713bdb4e48715ab13caefb4888ba2685 Author: Lucas Miller <122331581+luc-spec@users.noreply.github.com> Date: Tue Dec 19 15:26:48 2023 -0700 Update README.md run graphical via display sharing commit a9678704e5684cfb6e4028a2717f5f121b35f35b Author: Lucas Miller <122331581+luc-spec@users.noreply.github.com> Date: Tue Dec 19 15:23:39 2023 -0700 Update melodic.Dockerfile added rviz commit 405238b5d822fc92bb1b8aadd05042bffc6b7267 Author: Lucas Miller <122331581+luc-spec@users.noreply.github.com> Date: Tue Dec 19 14:34:10 2023 -0700 Update README.md commit ac7b0549cb6971bba9782cbc7edbe9120fc5e825 Author: Lucas Miller <122331581+luc-spec@users.noreply.github.com> Date: Tue Dec 19 14:17:28 2023 -0700 Update README.md commit 0529a57cb1eed7f14be72657e017057f2e9d3928 Author: Lucas Miller <122331581+luc-spec@users.noreply.github.com> Date: Tue Dec 19 14:14:42 2023 -0700 Delete kinetic.Dockerfile sticking to melodic commit d1fe5360d7c293f419f0b6e10b17d3664ee93d60 Author: Lucas Miller <122331581+luc-spec@users.noreply.github.com> Date: Tue Dec 19 14:14:04 2023 -0700 Update melodic.Dockerfile added packages not mentioned in the installation guide; fixed paths; tested with planar and opengl renderers commit 6a5db3a9074e5643f51a22af5bfac8b5e6ec4f2b Author: ddanon <5whyk8ie@danondaddy.anonaddy.me> Date: Thu Dec 14 17:54:53 2023 -0700 dockerfile made --- CONTAINER_README.md | 53 ++++++++++++++++++++++++++++++++++++ http-dependencies.yaml | 45 ++++++++++++++++++++++++++++++ melodic.Dockerfile | 62 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 CONTAINER_README.md create mode 100644 http-dependencies.yaml create mode 100644 melodic.Dockerfile diff --git a/CONTAINER_README.md b/CONTAINER_README.md new file mode 100644 index 0000000..7cd1335 --- /dev/null +++ b/CONTAINER_README.md @@ -0,0 +1,53 @@ +# Foreward + +The work herein is primarily that of Rebecq et al, in the Acknowlegements section below. This fork simply impelements a dockerized version such that ESIM can be used on platforms without ROS Melodic. + +## Suggested Installation + +After cloning this repository, simply build the dockerfile as follows. + +```bash +# where $(pwd) is /the/path/to/rpg_esim +podman build -t esim:melodic -f melodic.Dockerfile +``` + +Alternatively, build with docker (untested) + +```bash +podman build -t esim:melodic -f melodic.Dockerfile +``` + +## Run + +Then, simply run the container, source the setup file, and launch the renderer. Please refer to specific instructions to run a given simulator in [the original rpg_esim wiki](https://github.com/uzh-rpg/rpg_esim/wiki). + +```bash +# On the host +# Running as root via rootless podman mitigates security risks that come with root access to xhost. +# Use with caution if you are not running rootless podman! +podman run --rm -ti -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro esim +``` + +```bash +# In the container +. /home/user/sim_ws/devel/setup.bash +roscd esim_ros +# Based on the suggested test renderer +roslaunch esim_ros esim.launch config:=cfg/example.conf +``` + +An alternative, 3D, rendering option is below. + +### OpenGL Renderer + +```bash +roscd esim_ros +roslaunch esim_ros esim.launch config:=cfg/opengl.conf +``` + +## TODO +- [x] Add a graphical run script for visualization compatibility as discussed in numerous forum posts like [this one](https://unix.stackexchange.com/questions/330366/how-can-i-run-a-graphical-application-in-a-container-under-wayland) + +## Acknowledgements + +Thank you to the [Robotics and Perception Group](https://rpg.ifi.uzh.ch/) for all of their hard work and open source implementations. diff --git a/http-dependencies.yaml b/http-dependencies.yaml new file mode 100644 index 0000000..2591f7e --- /dev/null +++ b/http-dependencies.yaml @@ -0,0 +1,45 @@ +repositories: + catkin_simple: + type: git + url: https://github.com/catkin/catkin_simple.git + version: master + ze_oss: + type: git + url: https://github.com/uzh-rpg/ze_oss.git + version: master + gflags_catkin: + type: git + url: https://github.com/ethz-asl/gflags_catkin.git + version: master + glog_catkin: + type: git + url: https://github.com/ethz-asl/glog_catkin.git + version: master + eigen_catkin: + type: git + url: https://github.com/ethz-asl/eigen_catkin.git + version: master + eigen_checks: + type: git + url: https://github.com/ethz-asl/eigen_checks.git + version: master + minkindr: + type: git + url: https://github.com/ethz-asl/minkindr.git + version: master + minkindr_ros: + type: git + url: https://github.com/ethz-asl/minkindr_ros.git + version: master + yaml_cpp_catkin: + type: git + url: https://github.com/ethz-asl/yaml_cpp_catkin.git + version: master + rpg_dvs_ros: + type: git + url: https://github.com/uzh-rpg/rpg_dvs_ros.git + version: master + assimp_catkin: + type: git + url: https://github.com/uzh-rpg/assimp_catkin.git + version: master diff --git a/melodic.Dockerfile b/melodic.Dockerfile new file mode 100644 index 0000000..a69b625 --- /dev/null +++ b/melodic.Dockerfile @@ -0,0 +1,62 @@ +FROM ros:melodic-ros-base + +ARG DEBIAN_FRONTEND=noninteractive +ARG PROJ_PATH=/home/user/sim_ws +ARG ESIM_PATH=$PROJ_PATH/src/rpg_esim + +# Installing some essential system packages +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key 4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA +RUN apt-get update +RUN apt-get install -y \ + python3-vcstool \ + python3-catkin-tools \ + python3-pip \ + libproj-dev \ + libglm-dev \ + libopencv-dev \ + ros-melodic-image-transport \ + ros-melodic-cv-bridge \ + autoconf \ + libyaml-cpp-dev \ + ros-melodic-eigen-conversions \ + libtool \ + ros-melodic-tf-conversions \ + ros-melodic-tf \ + ros-melodic-pcl-ros \ + libglfw3-dev \ + libassimp-dev \ + ros-melodic-rviz + +RUN apt-get clean autoclean &&\ + rm -rf /var/lib/apt/lists/* + +RUN python3 -m pip install -U pip + +WORKDIR $PROJ_PATH +RUN catkin init +RUN catkin config --extend /opt/ros/melodic --cmake-args -DCMAKE_BUILD_TYPE=Release + +RUN mkdir -p $ESIM_PATH +COPY ./ $ESIM_PATH +WORKDIR $PROJ_PATH/src +RUN vcs-import < $ESIM_PATH/dependencies.yaml + +WORKDIR $PROJ_PATH/src/ze_oss +RUN touch \ + imp_3rdparty_cuda_toolkit/CATKIN_IGNORE \ + imp_app_pangolin_example/CATKIN_IGNORE \ + imp_benchmark_aligned_allocator/CATKIN_IGNORE \ + imp_bridge_pangolin/CATKIN_IGNORE \ + imp_cu_core/CATKIN_IGNORE \ + imp_cu_correspondence/CATKIN_IGNORE \ + imp_cu_imgproc/CATKIN_IGNORE \ + imp_ros_rof_denoising/CATKIN_IGNORE \ + imp_tools_cmd/CATKIN_IGNORE \ + ze_data_provider/CATKIN_IGNORE \ + ze_geometry/CATKIN_IGNORE \ + ze_imu/CATKIN_IGNORE \ + ze_trajectory_analysis/CATKIN_IGNORE + +WORKDIR $PROJ_PATH +RUN catkin build esim_ros +#ENTRYPOINT [". /home/user/sim_ws/devel/setup.bash"]