Skip to content

Commit bba6830

Browse files
committed
Update MoveIt2 build for new base image (issue #198)
1 parent 045f144 commit bba6830

2 files changed

Lines changed: 22 additions & 29 deletions

File tree

moveit2/Dockerfile

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ ARG SPACE_ROS_IMAGE=osrf/space-ros:latest
2424

2525
FROM ${SPACE_ROS_IMAGE}
2626

27+
SHELL ["bash", "-c"]
28+
2729
# Define arguments used in the metadata definition
2830
ARG VCS_REF
2931
ARG VERSION="preview"
@@ -41,12 +43,9 @@ LABEL org.label-schema.vcs-ref=${VCS_REF}
4143
# Disable prompting during package installation
4244
ARG DEBIAN_FRONTEND=noninteractive
4345

44-
# Clone all space-ros sources
45-
RUN mkdir ${SPACEROS_DIR}/src \
46-
&& vcs import ${SPACEROS_DIR}/src < ${SPACEROS_DIR}/exact.repos
47-
4846
# Define key locations
49-
ENV MOVEIT2_DIR=${HOME_DIR}/moveit2
47+
ENV MOVEIT2_DIR=${HOME}/moveit2
48+
ENV SPACEROS_WS=${HOME}/spaceros
5049

5150
# Make sure the latest versions of packages are installed
5251
# Using Docker BuildKit cache mounts for /var/cache/apt and /var/lib/apt ensures that
@@ -57,7 +56,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5756
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5857
--mount=type=cache,target=/var/lib/apt,sharing=locked \
5958
sudo apt-get dist-upgrade -y
60-
RUN rosdep update
59+
RUN sudo rosdep init && rosdep update
6160

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

95-
# Get the MoveIt2 source code
96-
WORKDIR ${HOME_DIR}
97-
RUN sudo git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO} moveit2/src
98-
RUN cd ${MOVEIT2_DIR}/src \
99-
&& sudo git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}
94+
# Clone all space-ros sources
95+
RUN mkdir -p ${SPACEROS_WS}/src \
96+
&& vcs import ${SPACEROS_WS}/src < ${SPACEROS_DIR}/scripts/spaceros.repos
10097

101-
# Update the ownership of the source files (had to use sudo above to work around
102-
# a possible inherited 'insteadof' from the host that forces use of ssh
103-
RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
98+
# Get the MoveIt2 source code
99+
WORKDIR ${MOVEIT2_DIR}/src
100+
RUN git clone https://github.com/ros-planning/moveit2.git -b ${ROS_DISTRO}
101+
RUN git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}
104102

105103
# Get rosinstall_generator
106104
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
@@ -113,33 +111,29 @@ COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
113111
RUN rosinstall_generator \
114112
--rosdistro ${ROS_DISTRO} \
115113
--deps \
116-
--exclude-path ${SPACEROS_DIR}/src \
114+
--exclude-path ${SPACEROS_WS}/ \
117115
--exclude $(cat /tmp/excluded-pkgs.txt) -- \
118116
-- $(cat /tmp/moveit2-pkgs.txt) \
119117
> /tmp/moveit2_generated_pkgs.repos
120118

121119
# Get the repositories required by MoveIt2, but not included in Space ROS
122120
WORKDIR ${MOVEIT2_DIR}
123121
RUN vcs import src < /tmp/moveit2_generated_pkgs.repos
124-
COPY --chown=${USERNAME}:${USERNAME} moveit2_tutorials.repos /tmp/
122+
COPY moveit2_tutorials.repos /tmp/
125123
RUN vcs import src < /tmp/moveit2_tutorials.repos
126124

127-
# Update the ownership of the source files (had to use sudo above to work around
128-
# a possible inherited 'insteadof' from the host that forces use of ssh
129-
RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
130-
131125
# Install system dependencies
132126
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
133127
--mount=type=cache,target=/var/lib/apt,sharing=locked \
134-
/bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash' \
135-
&& 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"
128+
/bin/bash -c 'source ${SPACEROS_DIR}/setup.bash' \
129+
&& 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"
136130

137131
# Apply a patch to octomap_msgs to work around a build issue
138132
COPY --chown=${USERNAME}:${USERNAME} octomap_fix.diff ./src/octomap_msgs
139133
RUN cd src/octomap_msgs && git apply octomap_fix.diff
140134

141135
# Build MoveIt2
142-
RUN /bin/bash -c 'source ${SPACEROS_DIR}/install/setup.bash \
136+
RUN /bin/bash -c 'source ${SPACEROS_DIR}/setup.bash \
143137
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON --event-handlers desktop_notification- status-'
144138

145139
# Add a couple sample GUI apps for testing

moveit2/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If building locally, the underlying base image can be set in the [build script](
1616

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

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

3232
The output will look something like this:
3333

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

4140
The new image is named **openrobotics/moveit2:latest**.

0 commit comments

Comments
 (0)