From b15d8d0d431e6522a57f964366213a4745f1f187 Mon Sep 17 00:00:00 2001 From: Johnson Sun Date: Thu, 5 Sep 2024 14:29:18 +0800 Subject: [PATCH] fix(aloha_ws): Correctly setup Aloha Interbotix dependencies --- aloha_ws/docker/.bashrc | 8 ++++++++ aloha_ws/docker/Dockerfile | 25 ++++++++++++++++++------- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/aloha_ws/docker/.bashrc b/aloha_ws/docker/.bashrc index ed090d4a..bff349f4 100644 --- a/aloha_ws/docker/.bashrc +++ b/aloha_ws/docker/.bashrc @@ -26,5 +26,13 @@ if [ ! -f $ROS2_WS/install/setup.bash ]; then echo "Workspace built." fi # TODO: Source other workspace environments as underlay +# Source Interbotix environment +source ~/interbotix_ws/install/setup.bash +# Source gazebo environment +# Ref: https://github.com/Interbotix/interbotix_ros_manipulators/issues/81#issuecomment-1562118208 +# Ref: https://classic.gazebosim.org/tutorials?tut=ros2_installing&cat=connect_ros#InstallGazebo +if [ $(arch) == "x86_64" ]; then + source /usr/share/gazebo/setup.sh +fi # Source workspace environment source $ROS2_WS/install/setup.bash diff --git a/aloha_ws/docker/Dockerfile b/aloha_ws/docker/Dockerfile index 805e444d..27dd921e 100644 --- a/aloha_ws/docker/Dockerfile +++ b/aloha_ws/docker/Dockerfile @@ -84,20 +84,31 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ # apt-get update && apt-get install -y \ # $OTHER_PACKAGES \ # && rm -rf /var/lib/apt/lists/* -# Install Aloha Interbotix dependencies -# Ref: https://docs.trossenrobotics.com/interbotix_xsarms_docs/ros_interface/ros2/software_setup.html#amd64-architecture -# Ref: https://github.com/Interbotix/interbotix_ros_manipulators/blob/humble/interbotix_ros_xsarms/install/amd64/xsarm_amd64_install.sh +# Install udevadm for later use RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ - apt-get update && apt-get install -y curl \ - && curl 'https://raw.githubusercontent.com/Interbotix/interbotix_ros_manipulators/d07c17cc0f868bf1f59ee8d8fa844e273f4699ff/interbotix_ros_xsarms/install/amd64/xsarm_amd64_install.sh' > xsarm_amd64_install.sh \ - && chmod +x xsarm_amd64_install.sh \ - && ./xsarm_amd64_install.sh -d humble \ + apt-get update && apt-get install -y \ + udev \ && rm -rf /var/lib/apt/lists/* USER $USERNAME # Create Gazebo cache directory with correct ownership to avoid permission issues after volume mount RUN mkdir /home/$USERNAME/.gazebo # TODO: Run additional commands as non-root user here + +# Install Aloha Interbotix dependencies +# Ref: https://docs.trossenrobotics.com/interbotix_xsarms_docs/ros_interface/ros2/software_setup.html#amd64-architecture +# Ref: https://github.com/Interbotix/interbotix_ros_manipulators/blob/humble/interbotix_ros_xsarms/install/amd64/xsarm_amd64_install.sh +# Set the `TERM` variable for the `tput` command in the `xsarm_amd64_install.sh` script. +# TODO: The github repos are cloned in the script for simplicity. +# It would be better to copy the repos directly into the `aloha_ws/src` directory for future development. +ENV TERM=xterm-256color +RUN --mount=type=cache,target=/var/cache/apt,sharing=private \ + cd ~ \ + && curl 'https://raw.githubusercontent.com/Interbotix/interbotix_ros_manipulators/d07c17cc0f868bf1f59ee8d8fa844e273f4699ff/interbotix_ros_xsarms/install/amd64/xsarm_amd64_install.sh' > xsarm_amd64_install.sh \ + && chmod +x xsarm_amd64_install.sh \ + && bash -ie ./xsarm_amd64_install.sh -d humble -n \ + && sudo rm -rf /var/lib/apt/lists/* + COPY .bashrc /home/$USERNAME/.bashrc # TODO: Copy additional files here ENTRYPOINT []