Skip to content

Commit

Permalink
Merge pull request space-ros#189 from space-ros/adjust-demos-for-new-…
Browse files Browse the repository at this point in the history
…base

Fix remaining issues in applications and demos from the updated spaceros base image
  • Loading branch information
eholum authored Oct 1, 2024
2 parents 588d5a9 + 2279408 commit 09ec444
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
# free up a lot of stuff from /usr/local
sudo rm -rf /usr/local
df -h
- name: Login to ghcr
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
- name: Set up buildx
Expand All @@ -33,6 +39,8 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
no-cache: false
build-args: |
SPACE_ROS_IMAGE=osrf/space-ros:main
outputs: type=docker,dest=/tmp/moveit2.tar
- name: Build space robots demo image
run: |
Expand All @@ -55,3 +63,5 @@ jobs:
cache-from: type=gha
cache-to: type=gha,mode=max
no-cache: false
build-args: |
SPACE_ROS_IMAGE=osrf/space-ros:main
17 changes: 10 additions & 7 deletions moveit2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
#
# The script provides the following build arguments:
#
# VCS_REF - The git revision of the Space ROS source code (no default value).
# VERSION - The version of Space ROS (default: "preview")
# VCS_REF - The git revision of the Space ROS source code (no default value).
# VERSION - The version of Space ROS (default: "preview")
# SPACE_ROS_IMAGE - The base Space ROS image to build on

FROM osrf/space-ros:latest
ARG SPACE_ROS_IMAGE=osrf/space-ros:latest

FROM ${SPACE_ROS_IMAGE}

# Define arguments used in the metadata definition
ARG VCS_REF
Expand Down Expand Up @@ -91,9 +94,9 @@ RUN python3 -m pip install -U \

# Get the MoveIt2 source code
WORKDIR ${HOME_DIR}
RUN sudo git clone https://github.com/moveit/moveit2.git -b ${ROSDISTRO} moveit2/src
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/moveit/moveit2_tutorials.git -b ${ROSDISTRO}
&& sudo git clone https://github.com/ros-planning/moveit2_tutorials.git -b ${ROS_DISTRO}

# 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
Expand All @@ -108,7 +111,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
COPY --chown=${USERNAME}:${USERNAME} moveit2-pkgs.txt /tmp/
COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
RUN rosinstall_generator \
--rosdistro ${ROSDISTRO} \
--rosdistro ${ROS_DISTRO} \
--deps \
--exclude-path ${SPACEROS_DIR}/src \
--exclude $(cat /tmp/excluded-pkgs.txt) -- \
Expand All @@ -129,7 +132,7 @@ RUN sudo chown -R ${USERNAME}:${USERNAME} ${MOVEIT2_DIR}
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"
&& 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
Expand Down
8 changes: 8 additions & 0 deletions moveit2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ To build the docker image, run:
./build.sh
```

By default, this will build on top of the latest released version of the Space ROS base image (typically `osrf/space-ros:latest`).
If building locally, the underlying base image can be set in the [build script](./build.sh), or through the environment with:

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

The build process will take about 30 minutes, depending on the host computer.

## Running the MoveIt2 Docker Image in a Container
Expand Down
4 changes: 3 additions & 1 deletion moveit2/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ echo ""

docker build -t $ORG/$IMAGE:$TAG \
--build-arg VCS_REF="$VCS_REF" \
--build-arg VERSION="$VERSION" .
--build-arg VERSION="$VERSION" \
--build-arg SPACE_ROS_IMAGE="${SPACE_ROS_IMAGE:-osrf/space-ros:latest}" \
.

echo ""
echo "##### Done! #####"
Expand Down
11 changes: 7 additions & 4 deletions navigation2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
#
# The script provides the following build arguments:
#
# VCS_REF - The git revision of the Space ROS source code (no default value).
# VERSION - The version of Space ROS (default: "preview")
# VCS_REF - The git revision of the Space ROS source code (no default value).
# VERSION - The version of Space ROS (default: "preview")
# SPACE_ROS_IMAGE - The base Space ROS image to build on

FROM osrf/space-ros:latest
ARG SPACE_ROS_IMAGE=osrf/space-ros:latest

FROM ${SPACE_ROS_IMAGE}

# Define arguments used in the metadata definition
ARG VCS_REF
Expand Down Expand Up @@ -62,7 +65,7 @@ RUN mkdir ${SPACEROS_DIR}/src \

# Generate repos file for nav2 dependencies, exclude packages from Space ROS src
RUN rosinstall_generator \
--rosdistro ${ROSDISTRO} \
--rosdistro ${ROS_DISTRO} \
--deps \
--exclude-path ${SPACEROS_DIR}/src -- \
-- $(cat ${NAVIGATION2_WS}/nav2_dep_keys.txt) \
Expand Down
8 changes: 8 additions & 0 deletions navigation2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ To build the docker image, run:

The build process will take about 30 minutes, depending on the host computer.

By default, this will build on top of the latest released version of the Space ROS base image (typically `osrf/space-ros:latest`).
If building locally, the underlying base image can be set in the [build script](./build.sh), or through the environment with:

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

## Running the Navigation2 Docker Image in a Container

After building the image, you can see the newly-built image by running:
Expand Down
4 changes: 3 additions & 1 deletion navigation2/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ echo ""

docker build -t $ORG/$IMAGE:$TAG \
--build-arg VCS_REF="$VCS_REF" \
--build-arg VERSION="$VERSION" .
--build-arg VERSION="$VERSION" \
--build-arg SPACE_ROS_IMAGE="${SPACE_ROS_IMAGE:-osrf/space-ros:latest}" \
.

echo ""
echo "##### Done! #####"
Expand Down
4 changes: 2 additions & 2 deletions space_robots/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
# COPY --chown=${USERNAME}:${USERNAME} demo-pkgs.txt /tmp/
# COPY --chown=${USERNAME}:${USERNAME} excluded-pkgs.txt /tmp/
# RUN rosinstall_generator \
# --rosdistro ${ROSDISTRO} \
# --rosdistro ${ROS_DISTRO} \
# --deps \
# --exclude-path ${SPACEROS_DIR}/src \
# --exclude-path ${MOVEIT2_DIR}/src \
Expand Down Expand Up @@ -91,7 +91,7 @@ RUN --mount=type=cache,target=/var/cache/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}
&& 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 \
Expand Down
2 changes: 1 addition & 1 deletion space_robots/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ docker exec -it <container-name> bash
Make sure packages are sourced:

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

```bash
Expand Down

0 comments on commit 09ec444

Please sign in to comment.