Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update demo projects to use the new base image #199

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 17 additions & 23 deletions moveit2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ ARG SPACE_ROS_IMAGE=osrf/space-ros:latest

FROM ${SPACE_ROS_IMAGE}

SHELL ["bash", "-c"]

# Define arguments used in the metadata definition
ARG VCS_REF
ARG VERSION="preview"
Expand All @@ -41,12 +43,9 @@ LABEL org.label-schema.vcs-ref=${VCS_REF}
# Disable prompting during package installation
ARG DEBIAN_FRONTEND=noninteractive

# Clone all space-ros sources
RUN mkdir ${SPACEROS_DIR}/src \
&& vcs import ${SPACEROS_DIR}/src < ${SPACEROS_DIR}/exact.repos

# Define key locations
ENV MOVEIT2_DIR=${HOME_DIR}/moveit2
ENV MOVEIT2_DIR=${HOME}/moveit2
ENV SPACEROS_WS=${HOME}/spaceros

# Make sure the latest versions of packages are installed
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
Expand All @@ -57,7 +56,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
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
RUN sudo rosdep init && rosdep update

# Install the various build and test tools
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
Expand Down Expand Up @@ -92,15 +91,14 @@ RUN python3 -m pip install -U \
pytest-rerunfailures \
pytest

# Get the MoveIt2 source code
WORKDIR ${HOME_DIR}
RUN sudo git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO} moveit2/src
RUN cd ${MOVEIT2_DIR}/src \
&& sudo git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}
# Clone all space-ros sources
RUN mkdir -p ${SPACEROS_WS}/src \
&& vcs import ${SPACEROS_WS}/src < ${SPACEROS_DIR}/scripts/spaceros.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}
# Get the MoveIt2 source code
WORKDIR ${MOVEIT2_DIR}/src
RUN git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO}
RUN git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}

# Get rosinstall_generator
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
Expand All @@ -113,33 +111,29 @@ COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
RUN rosinstall_generator \
--rosdistro ${ROS_DISTRO} \
--deps \
--exclude-path ${SPACEROS_DIR}/src \
--exclude-path ${SPACEROS_WS}/ \
--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/
COPY 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}

# 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 src --ignore-src --rosdistro ${ROS_DISTRO} -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"
/bin/bash -c 'source ${SPACEROS_DIR}/setup.bash' \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -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 \
RUN /bin/bash -c 'source ${SPACEROS_DIR}/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
Expand Down
11 changes: 5 additions & 6 deletions moveit2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If building locally, the underlying base image can be set in the [build script](

```bash
# Use a locally built image as the base
SPACE_ROS_IMAGE="space-ros:main" ./build.sh
SPACE_ROS_IMAGE="space-ros:latest" ./build.sh
```

The build process will take about 30 minutes, depending on the host computer.
Expand All @@ -31,11 +31,10 @@ docker image list

The output will look something like this:

```
REPOSITORY TAG IMAGE ID CREATED SIZE
openrobotics/moveit2 latest 6edb2edc9643 10 hours ago 15.5GB
openrobotics/spaceros latest 629b13cf7b74 12 hours ago 7.8GB
nvidia/cudagl 11.4.1-devel-ubuntu20.04 336416dfcbba 1 week ago 5.35GB
```docker image list
REPOSITORY TAG IMAGE ID CREATED SIZE
openrobotics/moveit2 latest 98cd8f08f954 About a minute ago 8.2GB
osrf/space-ros latest cf10cd2cb82c 27 hours ago 1.05GB
```

The new image is named **openrobotics/moveit2:latest**.
Expand Down
4 changes: 2 additions & 2 deletions nav2_demo/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ LABEL org.label-schema.vcs-ref=${VCS_REF}
ARG DEBIAN_FRONTEND=noninteractive

# Define workspace locations
ENV NAVIGATION2_WS=${HOME_DIR}/nav2_ws
ENV NAV2_DEPS_WS=${HOME_DIR}/nav2_deps_ws
ENV NAVIGATION2_WS=${HOME}/nav2_ws
ENV NAV2_DEPS_WS=${HOME}/nav2_deps_ws

# Setup mars_rover demo
# Install map file for localization
Expand Down
21 changes: 15 additions & 6 deletions navigation2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,17 @@ ARG DEBIAN_FRONTEND=noninteractive

SHELL ["/bin/bash", "-c"]

# Install required dependencies
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt update && \
sudo apt install -y \
python3-rosdep \
python3-vcstool
RUN sudo rosdep init && rosdep update

# Define workspace locations
ENV NAVIGATION2_WS=${HOME_DIR}/nav2_ws
ENV NAVIGATION2_WS=${HOME}/nav2_ws

RUN mkdir -p ${NAVIGATION2_WS}/src

Expand All @@ -56,19 +65,19 @@ RUN vcs import --shallow src < navigation2.repos
COPY --chown=spaceros-user:spaceros-user src/ src

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
source ${SPACEROS_DIR}/install/setup.bash && \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
source ${SPACEROS_DIR}/setup.bash && \
sudo apt update && \
rosdep install -i --from-path src --skip-keys $(cat excluded-pkgs.txt) -y
RUN source ${SPACEROS_DIR}/install/setup.bash && \
RUN source ${SPACEROS_DIR}/setup.bash && \
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --no-warn-unused-cli
RUN rm -rf src build log


# Install rviz2 to send goals to Nav2.
# Install rviz2 to send goals to Nav2.
# TODO(xfiderek): Remove rviz2 and humble-nav2 froms this image
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
sudo apt update && \
sudo apt install -y ros-humble-rviz2 ros-humble-nav2-bringup

Expand Down
6 changes: 3 additions & 3 deletions navigation2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ docker image list
The output will look something like this:

```
REPOSITORY TAG IMAGE ID CREATED SIZE
osrf/space_nav2 latest 6edb2edc9643 10 hours ago 15.5GB
osrf/space-ros latest 629b13cf7b74 12 hours ago 7.8GB
REPOSITORY TAG IMAGE ID CREATED SIZE
osrf/space_nav2 latest 7016292fba1c 32 minutes ago 3.65GB
osrf/space-ros latest cf10cd2cb82c 4 days ago 1.05GB
```

The new image is named **osrf/space_nav2:latest**.
Expand Down
11 changes: 4 additions & 7 deletions space_robots/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker"
LABEL org.label-schema.vcs-ref=${VCS_REF}

# Define a few key variables
ENV DEMO_DIR=${HOME_DIR}/demos_ws
ENV DEMO_DIR=${HOME}/demos_ws
ENV IGNITION_VERSION fortress
ENV GZ_VERSION fortress

Expand Down Expand Up @@ -84,22 +84,19 @@ RUN cd mongo-cxx-driver-r3.6.7/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCM
# 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 vcs import src < /tmp/demo_manual_pkgs.repos && /bin/bash -c 'source "${SPACEROS_DIR}/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 "${SPACEROS_DIR}/setup.bash"' \
&& /bin/bash -c 'source "${MOVEIT2_DIR}/install/setup.bash"' \
&& rosdep install --from-paths src --ignore-src -r -y --rosdistro ${ROS_DISTRO}

# Build the demo
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash && source ${MOVEIT2_DIR}/install/setup.bash \
RUN /bin/bash -c 'source ${SPACEROS_DIR}/setup.bash && source ${MOVEIT2_DIR}/install/setup.bash \
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release'

# 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"]
Expand Down
7 changes: 2 additions & 5 deletions space_robots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Depending on the host computer, you might need to remove the ```--gpus all``` fl
## Running the Demos

### Curiosity Mars rover demo

Launch the demo:
```bash
ros2 launch mars_rover mars_rover.launch.py
Expand All @@ -57,11 +58,7 @@ docker exec -it <container-name> bash
Make sure packages are sourced:

```bash
source ${SPACEROS_DIR}/install/setup.bash
```

```bash
source ~/demos_ws/install/setup.bash
source ${DEMO_DIR}/install/setup.bash
```

#### Available Commands
Expand Down
Loading