diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000..b8c1eedb --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu +{ + "name": "Ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/base:jammy", + + // Features to add to the dev container. More info: https://containers.dev/features. + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:2": {} + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + // "postCreateCommand": "uname -a", + + // Configure tool-specific properties. + "customizations": { + "vscode": { + "extensions": [ + "mhutchie.git-graph", + "openrobotics.spaceros-dashboard" + ] + } + } + + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f33a02cd --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for more information: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://containers.dev/guide/dependabot + +version: 2 +updates: + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/freisa_on_mars/Dockerfile b/freisa_on_mars/Dockerfile new file mode 100644 index 00000000..9f748d64 --- /dev/null +++ b/freisa_on_mars/Dockerfile @@ -0,0 +1,218 @@ +# ========================================================================== +# File: freisa_on_mars/Dockerfile +# +# Adapted from +# * https://github.com/space-ros/docker/blob/main/moveit2/Dockerfile +# * https://github.com/space-ros/docker/blob/main/space_robots/Dockerfile +# ========================================================================== + +FROM osrf/space-ros:latest +# FROM openrobotics/moveit2:latest + +# Define arguments used in the metadata definition +ARG VCS_REF +ARG VERSION="preview" + +# Specify the docker image metadata +LABEL org.label-schema.schema-version="1.0" +LABEL org.label-schema.name="FREISA meets Curiosity Rover" +LABEL org.label-schema.description="FREISA Robot Dog meets Curiosity rover demo on the Space ROS platform" +LABEL org.label-schema.vendor="B-AROL-O Team" +LABEL org.label-schema.version=${VERSION} +LABEL org.label-schema.url="https://github.com/space-ros" +LABEL org.label-schema.vcs-url="https://github.com/space-ros/demos" +LABEL org.label-schema.vcs-ref=${VCS_REF} + +# Define a few key variables +ENV DEMO_DIR=${HOME_DIR}/demos_ws +ENV IGNITION_VERSION=fortress +ENV GZ_VERSION=fortress + +# Disable prompting during package installation +ARG DEBIAN_FRONTEND=noninteractive + +# === BEGIN Adaptation from space-ros/docker/moveit2/Dockerfile === + +# Define key locations +ENV MOVEIT2_DIR=${HOME_DIR}/moveit2 + +# Make sure the latest versions of packages are installed +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get dist-upgrade -y +RUN rosdep update + +# Get the MoveIt2 source code +WORKDIR ${HOME_DIR} +RUN git clone https://github.com/moveit/moveit2.git -b ${ROSDISTRO} moveit2/src +RUN cd ${MOVEIT2_DIR}/src \ + && git clone https://github.com/moveit/moveit2_tutorials.git -b ${ROSDISTRO} + +# Get rosinstall_generator +# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that +# the cache won't make it into the built image but will be maintained between steps. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update -y && sudo apt-get install -y python3-rosinstall-generator + +RUN mkdir -p ${SPACEROS_DIR}/src # HACK + +RUN touch DEBUG-01.txt + +# Generate repos file for moveit2 dependencies, excluding packages from Space ROS core. +WORKDIR ${MOVEIT2_DIR} +COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/ +COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/ +RUN rosinstall_generator \ + --rosdistro ${ROSDISTRO} \ + --deps \ + --exclude-path ${SPACEROS_DIR}/src \ + --exclude $(cat /tmp/excluded-pkgs.txt) -- \ + -- $(cat /tmp/moveit2-pkgs.txt) \ + > /tmp/moveit2_generated_pkgs.repos + +# Get the repositories required by MoveIt2, but not included in Space ROS +WORKDIR ${MOVEIT2_DIR} +RUN vcs import src < /tmp/moveit2_generated_pkgs.repos +COPY --chown=${USERNAME}:${USERNAME} moveit2_tutorials.repos /tmp/ +RUN vcs import src < /tmp/moveit2_tutorials.repos + +# Update the ownership of the source files (had to use sudo above to work around +# a possible inherited 'insteadof' from the host that forces use of ssh +RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR} + +RUN touch DEBUG-02.txt + +# Install system dependencies +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \ + && rosdep install --from-paths ../spaceros/src src --ignore-src \ + --rosdistro ${ROSDISTRO} -r -y --skip-keys \ + "console_bridge generate_parameter_library fastcdr fastrtps rti-connext-dds-5.3.1 urdfdom_headers rmw_connextdds ros_testing rmw_connextdds rmw_fastrtps_cpp rmw_fastrtps_dynamic_cpp composition demo_nodes_py lifecycle rosidl_typesupport_fastrtps_cpp rosidl_typesupport_fastrtps_c ikos diagnostic_aggregator diagnostic_updater joy qt_gui rqt_gui rqt_gui_py" + +# Apply a patch to octomap_msgs to work around a build issue +COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs +RUN cd src/octomap_msgs && git apply octomap_fix.diff + +# Build MoveIt2 +RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \ + && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-' + +# # Add a couple sample GUI apps for testing +# RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ +# --mount=type=cache,target=/var/lib/apt,sharing=locked \ +# sudo apt-get install -y \ +# firefox \ +# glmark2 \ +# libcanberra-gtk3-0 \ +# libpci-dev \ +# xauth \ +# xterm + +# === END Adaptation from space-ros/docker/moveit2/Dockerfile === + +RUN touch DEBUG-11.txt + +# TODO(anyone): remove demo-pkgs.txt, no packages left after exclusions +# Generate repos file for demo dependencies, excluding packages from Space ROS core. +# COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/ +# COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/ +# RUN rosinstall_generator \ +# --rosdistro ${ROSDISTRO} \ +# --deps \ +# --exclude-path ${SPACEROS_DIR}/src \ +# --exclude-path ${MOVEIT2_DIR}/src \ +# --exclude $(cat /tmp/excluded-pkgs.txt) -- \ +# -- $(cat /tmp/demo-pkgs.txt) \ +# > /tmp/demo_generated_pkgs.repos + +RUN mkdir -p ${DEMO_DIR}/src +WORKDIR ${DEMO_DIR} + +RUN touch DEBUG-12.txt + +# Install libmongoc for development +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get install libmongoc-dev -y + +# Compile mongo cxx driver https://mongocxx.org/mongocxx-v3/installation/linux/ +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get install libssl-dev build-essential devscripts debian-keyring fakeroot \ + debhelper cmake libboost-dev libsasl2-dev libicu-dev libzstd-dev doxygen -y +RUN wget https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz +RUN tar -xzf mongo-cxx-driver-r3.6.7.tar.gz +RUN cd mongo-cxx-driver-r3.6.7/build \ + && cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local \ + && sudo cmake --build . --target EP_mnmlstc_core \ + && cmake --build . \ + && sudo cmake --build . --target install + +RUN touch DEBUG-15.txt + +# Get the source for the dependencies +# RUN vcs import src < /tmp/demo_generated_pkgs.repos +COPY --chown=${USERNAME}:${USERNAME} demo_manual_pkgs.repos /tmp/ +RUN vcs import src < /tmp/demo_manual_pkgs.repos \ + && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' + +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get update -y \ + && /bin/bash -c 'source "${SPACEROS_DIR}/install/setup.bash"' \ + && /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \ + && rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROSDISTRO} + +RUN vcs import src < "${DEMO_DIR}/src/mini_pupper_ros/.minipupper.repos" + +# HACK: Move out package whose build still fails +RUN /bin/mkdir -p ../NO_src \ + && for d in champ ros2_controllers; do mv "src/$d" "../NO_src/"; done + +# Build the demo +RUN /bin/bash -c '\ + source "${SPACEROS_DIR}/install/setup.bash" \ + && source "${MOVEIT2_DIR}/install/setup.bash" \ + && colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release' + +# === TODO: The command above fails ============================================ +# --- stderr: forward_command_controller +# CMake Error at CMakeLists.txt:26 (find_package): +# By not providing "Findcontroller_interface.cmake" in CMAKE_MODULE_PATH this +# project has asked CMake to find a package configuration file provided by +# "controller_interface", but CMake did not find one. +# +# Could not find a package configuration file provided by +# "controller_interface" with any of the following names: +# +# controller_interfaceConfig.cmake +# controller_interface-config.cmake +# +# Add the installation prefix of "controller_interface" to CMAKE_PREFIX_PATH +# or set "controller_interface_DIR" to a directory containing one of the +# above files. If "controller_interface" provides a separate development +# package or SDK, be sure it has been installed. +# +# +# --- +# Failed <<< forward_command_controller [1.84s, exited with code 1] +# ============================================================================== + +RUN touch DEBUG-21.txt + +# # Add the user to the render group so that the user can access /dev/dri/renderD128 +# RUN sudo usermod -aG render $USERNAME + +# # Setup the entrypoint +# COPY ./entrypoint.sh / +# ENTRYPOINT ["/entrypoint.sh"] +# CMD ["bash"] + +# EOF diff --git a/freisa_on_mars/README.md b/freisa_on_mars/README.md new file mode 100644 index 00000000..e8741998 --- /dev/null +++ b/freisa_on_mars/README.md @@ -0,0 +1,73 @@ +# FREISA Robot Dog with Space ROS Mars Rover Demo + +## Introduction + +This demo integrates the simulation of the [FREISA Robot Dog](https://github.com/B-AROL-O/FREISA) (based on the [Mini Pupper 2 Pro](https://www.kickstarter.com/projects/mdrobotkits/md-robot-kits-open-source-support-your-genai-creativity) by [MangDang (HK) Limited](https://mangdang.store/)) inside the [Space ROS Mars Rover demo](https://space-ros.github.io/docs/rolling/Demos.html). + +This code is a part of the following challenge: + +* Challenge Name: NASA Space ROS Sim Summer Sprint Challenge +* Team Lead Freelancer Username: [@gmacario](https://www.freelancer.com/u/gmacario) +* Submission Title: Integrate FREISA Robot Dog with Space ROS Mars Rover Demo + +[![FREISA meets NASA Space ROS](https://img.youtube.com/vi/KcfOwAC_WE0/0.jpg)](https://www.youtube.com/watch?v=KcfOwAC_WE0 "FREISA meets NASA Space ROS") + + + + + + + + + + + +## Added bonus + +The proposed feature is only dealing with the integration of the [Mini Pupper 2](https://github.com/mangdangroboticsclub) robot inside Space ROS demo. +However, once the PR is merged, as an added bonus it should be possible to instantiate in the Space ROS Demo any of the quadruped robots supported by [CHAMP](https://github.com/chvmp/champ): + +![champ](https://raw.githubusercontent.com/chvmp/champ/master/docs/images/robots.gif) + +## Authors + +The FREISA Robot Dog with Space ROS Mars Rover Demo is another fine project by [the B-AROL-O Team](https://github.com/B-AROL-O) - a group of friends who in their spare time enjoy creating fun projects with Robotics, Computer Vision and [LEGO®](https://www.lego.com/). + +Everything we do - both hardware and software - is Open Source and [shared on GitHub](https://github.com/B-AROL-O). + +Our projects have been awarded several prizes in worldwide competitions on Computer Vision and robotics. +As an example, project "[Four-legged Robot Ensuring Intelligent Sprinkler Automation](https://www.hackster.io/projects/845012)" (a.k.a. [FREISA](https://github.com/B-AROL-O/FREISA)) - was the Grand Prize Winner 🥇 of the [OpenCV AI Competition 2023](https://www.hackster.io/contests/opencv-ai-competition-2023) with [OpenCV](https://www.hackster.io/opencv), [Khadas](https://www.hackster.io/khadas) and [Seeed Studio](https://www.hackster.io/seeed). + +[![OpenCV AI Competition 2023 Grand Prize Winners - OpenCV Live 126](https://img.youtube.com/vi/iUe4N7yvpmA/0.jpg)](https://www.youtube.com/watch?v=iUe4N7yvpmA "OpenCV AI Competition 2023 Grand Prize Winners - OpenCV Live 126") + +### How to get in touch + +You can reach out to us through the following platforms: + +* [![Instagram](https://img.icons8.com/small/16/000000/instagram-new.png)](https://instagram.com/baroloteam) Instagram: [@baroloteam](https://instagram.com/baroloteam) + +* [![Twitter](https://img.icons8.com/small/16/000000/twitter.png)](https://x.com/baroloteam) X: [@baroloteam]() + +* [![GitHub](https://img.icons8.com/small/16/000000/github.png)](https://github.com/B-AROL-O) GitHub: [B-AROL-O](https://github.com/B-AROL-O) + + diff --git a/freisa_on_mars/build.sh b/freisa_on_mars/build.sh new file mode 100755 index 00000000..2624a647 --- /dev/null +++ b/freisa_on_mars/build.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +ORG=baroloteam +IMAGE=freisa_on_mars +TAG=latest + +VCS_REF="" +VERSION=preview + +# Exit script with failure if build fails +set -eo pipefail + +echo "" +echo "##### Building freisa_on_mars Demo Docker Image #####" +echo "" + +docker build -t $ORG/$IMAGE:$TAG \ + --build-arg VCS_REF="$VCS_REF" \ + --build-arg VERSION="$VERSION" . + +echo "" +echo "##### Done! #####" + +# EOF diff --git a/freisa_on_mars/demo_manual_pkgs.repos b/freisa_on_mars/demo_manual_pkgs.repos new file mode 100644 index 00000000..f9c1a844 --- /dev/null +++ b/freisa_on_mars/demo_manual_pkgs.repos @@ -0,0 +1,77 @@ +# freisa_on_mars/demo_manual_pkgs.repos +# +# Adapted from https://github.com/space-ros/docker/blob/main/space_robots + +repositories: + demos: + type: git + # FIXME: Update url/version once is merged + # url: https://github.com/space-ros/demos.git + url: https://github.com/B-AROL-O/space-ros-demos.git + # version: main + # version: freisa_on_mars + version: dev-gmacario + + # === Repositories used by space_robots === + # See https://github.com/space-ros/docker/blob/main/space_robots/demo_manual_pkgs.repos + + gz_ros2_control: + type: git + url: https://github.com/ros-controls/gz_ros2_control.git + version: humble + qt_gui_core: + type: git + url: https://github.com/ros-visualization/qt_gui_core.git + version: humble + ros2_controllers: + type: git + url: https://github.com/tonylitianyu/ros2_controllers.git + version: effort_group_position_controller_2 + actuator_msgs: + type: git + url: https://github.com/rudislabs/actuator_msgs.git + version: main + ros_gz: + type: git + url: https://github.com/gazebosim/ros_gz.git + version: humble + simulation: + type: git + url: https://github.com/space-ros/simulation.git + version: main + ros-humble-warehouse-ros-mongo: + type: git + url: https://github.com/moveit/warehouse_ros_mongo.git + version: ros2 + vision_msgs: + type: git + url: https://github.com/ros-perception/vision_msgs.git + version: ros2 + gps_msgs: + type: git + url: https://github.com/swri-robotics/gps_umd.git + path: gps_msgs + version: 113782d + + # === Extra repositories required by freisa_on_mars === + mini_pupper_ros: + type: git + url: https://github.com/B-AROL-O/mini_pupper_ros.git + version: ros2-dev + + # From https://github.com/B-AROL-O/mini_pupper_ros/blob/ros2-dev/.minipupper.repos + # TODO: vcs import < mini_pupper_ros/.minipupper.repos --recursive + champ/champ: + type: git + url: https://github.com/mangdangroboticsclub/champ.git + version: ros2 + champ/champ_teleop: + type: git + url: https://github.com/chvmp/champ_teleop.git + version: ros2 + ldlidar_stl_ros: + type: git + url: https://github.com/ldrobotSensorTeam/ldlidar_stl_ros2.git + version: master + +# EOF diff --git a/freisa_on_mars/entrypoint.sh b/freisa_on_mars/entrypoint.sh new file mode 100755 index 00000000..d1b51f26 --- /dev/null +++ b/freisa_on_mars/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +# Setup the Demo environment +source "${DEMO_DIR}/install/setup.bash" +exec "$@" diff --git a/freisa_on_mars/excluded-pkgs.txt b/freisa_on_mars/excluded-pkgs.txt new file mode 100644 index 00000000..890bc003 --- /dev/null +++ b/freisa_on_mars/excluded-pkgs.txt @@ -0,0 +1,10 @@ +fastcdr +fastrtps +fastrtps_cmake_module +rmw_fastrtps_cpp +rmw_fastrtps_dynamic_cpp +rmw_fastrtps_shared_cpp +rmw_connextdds +rosidl_typesupport_fastrtps_c +rosidl_typesupport_fastrtps_cpp +urdfdom_headers diff --git a/freisa_on_mars/moveit2-pkgs.txt b/freisa_on_mars/moveit2-pkgs.txt new file mode 100644 index 00000000..7aa8a566 --- /dev/null +++ b/freisa_on_mars/moveit2-pkgs.txt @@ -0,0 +1,38 @@ +ackermann_msgs +angles +backward_ros +control_msgs +control_toolbox +eigen_stl_containers +geometric_shapes +graph_msgs +ignition/ignition_cmake2_vendor +ignition/ignition_math6_vendor +image_common +interactive_markers +joint_state_publisher +laser_geometry +launch_param_builder +moveit_msgs +moveit_resources +moveit_task_constructor +navigation_msgs +object_recognition_msgs +octomap +ompl +orocos_kinematics_dynamics +py_binding_tools +python_qt_binding +random_numbers +realtime_tools +resource_retriever +ros2_control +ros2_controllers +ruckig +rviz2 +srdfdom +urdf_parser_py +vision_opencv +warehouse_ros +xacro +yaml_cpp_vendor diff --git a/freisa_on_mars/moveit2_tutorials.repos b/freisa_on_mars/moveit2_tutorials.repos new file mode 100644 index 00000000..d06986a9 --- /dev/null +++ b/freisa_on_mars/moveit2_tutorials.repos @@ -0,0 +1,18 @@ +repositories: + moveit_task_constructor: + type: git + url: https://github.com/moveit/moveit_task_constructor.git + version: humble + moveit_visual_tools: + type: git + url: https://github.com/moveit/moveit_visual_tools + version: ros2 + rosparam_shortcuts: + type: git + url: https://github.com/PickNikRobotics/rosparam_shortcuts + version: ros2 + rviz_visual_tools: + type: git + url: https://github.com/PickNikRobotics/rviz_visual_tools.git + version: ros2 + diff --git a/freisa_on_mars/octomap_fix.diff b/freisa_on_mars/octomap_fix.diff new file mode 100644 index 00000000..ea500e04 --- /dev/null +++ b/freisa_on_mars/octomap_fix.diff @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cd3112a..72403c5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -36,7 +36,7 @@ rosidl_generate_interfaces(${PROJECT_NAME} + ) + + install(DIRECTORY include/ +- DESTINATION include ++ DESTINATION include/${PROJECT_NAME} + FILES_MATCHING PATTERN "*.h" + PATTERN ".svn" EXCLUDE) + diff --git a/freisa_on_mars/run.sh b/freisa_on_mars/run.sh new file mode 100755 index 00000000..7478817a --- /dev/null +++ b/freisa_on_mars/run.sh @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +# Runs a docker container with the image created by build.bash +# Requires: +# docker +# an X server + +IMG_NAME=baroloteam/freisa_on_mars + +# Replace `/` with `_` to comply with docker container naming +# And append `_runtime` +CONTAINER_NAME="$(tr '/' '_' <<< "$IMG_NAME")" + +# Sanity checks +if [ -z "$DISPLAY" ]; then + export DISPLAY=:0 + echo "Warning: DISPLAY undefined, set to $DISPLAY" +fi +if [ -z "$TERM" ]; then + export TERM=xterm + echo "Warning: TERM undefined, set to $TERM" +fi +if [ -z "$XAUTHORITY" ]; then + export XAUTHORITY=~/.Xauthority + echo "Warning: XAUTHORITY undefined, set to $XAUTHORITY" + xauth extract \- $DISPLAY >>$XAUTHORITY +fi + +# Start the container +# +# --rm: delete container after exiting +# -it: Interactive TTY mode so you can use a shell. +# --network host: Does not isolate Docker container from host's network interfaces. +# Allows all traffic to pass through as if it originated from the host. +# In our case, useful for DDS traffic for ROS. +# -e DISPLAY: Pass the X11 display through to the container. +# -e TERM: Pass the kind of terminal being used through to the container. +# -e QT_X11_NO_MITSHM=1: Disables shared memory extension for Qt/X11, which does not work consistently inside a process namespace like a container. +# -v "$XAUTHORITY:/.Xauthority": the $XAUTHORITY environment variable on the host contains the path to a file that grants access to X11. +# We mount the path defined in that environment variable into the container at /.Xauthority. +# -e XAUTHORITY=/.Xauthority: We set $XAUTHORITY *inside* the container to the place we just mounted the Xauthority (/.Xauthority) +# +# Credits: +# * https://github.com/space-ros/docker/pull/168 +# * https://github.com/space-ros/docker/pull/175 +# +docker run --rm -it --name $CONTAINER_NAME \ + --network host \ + --volume=/tmp/.X11-unix:/tmp/.X11-unix \ + --volume "$XAUTHORITY:/.Xauthority" \ + --device=/dev/dri:/dev/dri \ + -e DISPLAY \ + -e TERM \ + -e QT_X11_NO_MITSHM=1 \ + -e XAUTHORITY=/.Xauthority \ + $IMG_NAME + + +# EOF