diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index b790cfd..c31d45c 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -60,7 +60,8 @@ jobs: docker run --rm \ ${{ steps.meta.outputs.tags }} \ bash -c " - colcon test && + # Just test our things + colcon test --paths src/wilbur/* && colcon test-result --verbose " diff --git a/.gitmodules b/.gitmodules index 45c517e..7b9148e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "src/external/serial"] path = src/external/serial url = https://github.com/tylerjw/serial.git +[submodule "src/external/mujoco_ros2_control"] + path = src/external/mujoco_ros2_control + url = https://github.com/ros-controls/mujoco_ros2_control.git diff --git a/Dockerfile b/Dockerfile index 8f65401..a5d6c8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -87,14 +87,14 @@ RUN groupadd -g ${USER_GID} ${USERNAME} \ && useradd -l -u ${USER_UID} -g ${USER_GID} --create-home -m -s /bin/bash -G sudo,adm,dialout,dip,plugdev,video ${USERNAME} \ && echo "${USERNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers && \ mkdir -p \ - /home/${USERNAME}/.ccache \ - /home/${USERNAME}/.colcon \ - /home/${USERNAME}/.ros \ - /home/${USERNAME}/.bash \ - ${ER4_WS}/src \ - ${ER4_WS}/build \ - ${ER4_WS}/install \ - ${ER4_WS}/log && \ + /home/${USERNAME}/.ccache \ + /home/${USERNAME}/.colcon \ + /home/${USERNAME}/.ros \ + /home/${USERNAME}/.bash \ + ${ER4_WS}/src \ + ${ER4_WS}/build \ + ${ER4_WS}/install \ + ${ER4_WS}/log && \ chown -R ${USERNAME}:${USERNAME} /home/${USERNAME} # Setup the install directory and copy the workspace to it. @@ -128,6 +128,12 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ ros-${ROS_DISTRO}-rmw-fastrtps-cpp \ ros-${ROS_DISTRO}-plotjuggler-ros +# Install nanobind from pip rather than rosdep, and include additional deps for the mujoco conversion process. +ENV PIP_BREAK_SYSTEM_PACKAGES=1 +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + pip3 install nanobind mujoco==3.5.0 obj2mjcf trimesh pycollada + # Copy in the remainder of the src directory COPY --chown=${USERNAME}:${USERNAME} src/ src/ @@ -160,6 +166,24 @@ RUN echo "source /entrypoint.sh" >> ~/.bashrc # Make it obvious when operating in a container RUN echo "PS1=\"${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\](docker):\[\033[01;34m\]\w\[\033[00m\]\$ \"" >> ~/.bashrc +# Modify for MuJoCo +RUN sudo chmod a+rwx /opt/ros/jazzy/opt/mujoco_vendor/bin/mujoco_plugin/ + +# Added to support headless accelerated rendering in the container. For more information see +# https://bender.jsc.nasa.gov/confluence/spaces/~eholum/pages/325397633/Graphics+Acceleration+with+FastX +# Add additional logic to make sure we clone the correct version for our CPU. +RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \ + --mount=type=cache,target=/var/lib/apt,sharing=locked \ + sudo apt-get -y update && \ + sudo apt-get install -q -y --no-install-recommends \ + libxv1 \ + libglu1-mesa \ + libegl1 +RUN ARCH=$(dpkg --print-architecture); \ + wget https://github.com/VirtualGL/virtualgl/releases/download/3.1.3/virtualgl_3.1.3_${ARCH}.deb && \ + sudo dpkg -i virtualgl_3.1.3_${ARCH}.deb && \ + rm virtualgl_3.1.3_${ARCH}.deb + ENTRYPOINT ["/entrypoint.sh"] # Source built dev image for automated testing. @@ -181,11 +205,11 @@ USER root RUN OLD_UID=$(id -u ${USERNAME}) && \ OLD_GID=$(id -g ${USERNAME}) && \ if [ "${OLD_UID}" != "${USER_UID}" ] || [ "${OLD_GID}" != "${USER_GID}" ]; then \ - sed -i "s/^\(${USERNAME}:[^:]*:\)[^:]*:[^:]*:/\1${USER_UID}:${USER_GID}:/" /etc/passwd && \ - sed -i "s/^\(${USERNAME}:[^:]*:\)[^:]*:/\1${USER_GID}:/" /etc/group && \ - find /home/${USERNAME} \ - \( -user ${OLD_UID} -o -group ${OLD_GID} \) \ - -print0 | xargs -0 -P $(nproc) -n 1000 chown ${USER_UID}:${USER_GID}; \ + sed -i "s/^\(${USERNAME}:[^:]*:\)[^:]*:[^:]*:/\1${USER_UID}:${USER_GID}:/" /etc/passwd && \ + sed -i "s/^\(${USERNAME}:[^:]*:\)[^:]*:/\1${USER_GID}:/" /etc/group && \ + find /home/${USERNAME} \ + \( -user ${OLD_UID} -o -group ${OLD_GID} \) \ + -print0 | xargs -0 -P $(nproc) -n 1000 chown ${USER_UID}:${USER_GID}; \ fi USER ${USERNAME} diff --git a/docker-compose.yml b/docker-compose.yml index 3ce2d9c..0ed6508 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -45,6 +45,9 @@ services: # default to colorized output of ros logs - RCUTILS_COLORIZED_OUTPUT=1 - NVIDIA_DRIVER_CAPABILITIES=all + # For remote graphics acceleration, no effect if not using VGL + - VGL_DISPLAY=:0 + - VGL_COMPRESS=proxy volumes: # If they are present, mount DDS configurations from the host machine into the container. # If not, fallback to the default localhost configurations for both fastrtps and cyclonedds. diff --git a/src/external/mujoco_ros2_control b/src/external/mujoco_ros2_control new file mode 160000 index 0000000..58f465b --- /dev/null +++ b/src/external/mujoco_ros2_control @@ -0,0 +1 @@ +Subproject commit 58f465b1b4634a6f366e71919189574f5d95c1e8 diff --git a/src/external/ros2_robotiq_gripper b/src/external/ros2_robotiq_gripper index 078f2e6..6993c62 160000 --- a/src/external/ros2_robotiq_gripper +++ b/src/external/ros2_robotiq_gripper @@ -1 +1 @@ -Subproject commit 078f2e644477ea979dac74969ea833a4f778624a +Subproject commit 6993c627a7e6cf53b4849076db6515f2b92405b8 diff --git a/src/wilbur b/src/wilbur index 81fe97b..d0db831 160000 --- a/src/wilbur +++ b/src/wilbur @@ -1 +1 @@ -Subproject commit 81fe97b3577e1912b1f51cb7493963ebcb54f854 +Subproject commit d0db8317b41ec94cdba4bfc5d3e25bef15971026