Skip to content

Instantly share code, notes, and snippets.

@Aposhian
Last active June 24, 2022 18:58
Show Gist options
  • Save Aposhian/043359e09a203900e8db55407a8b5e38 to your computer and use it in GitHub Desktop.
Save Aposhian/043359e09a203900e8db55407a8b5e38 to your computer and use it in GitHub Desktop.
Reproduction of FastDDS failing to activate Nav2
services:
nav2:
image: fastddsrepro
build:
context: ./
target: fastrtps
args:
- BASE_IMAGE=ros:galactic
command: ros2 launch nav2_bringup navigation_launch.py
network_mode: host
ipc: host
environment:
- RMW_IMPLEMENTATION
- ROS_DOMAIN_ID
bagger:
image: fastddsrepro
build:
context: ./
target: fastrtps
args:
- BASE_IMAGE=ros:galactic
command: ros2 bag record -a
network_mode: host
ipc: host
environment:
- RMW_IMPLEMENTATION
- ROS_DOMAIN_ID
# syntax=docker/dockerfile:1.4
ARG BASE_IMAGE
FROM $BASE_IMAGE as base
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \
--mount=type=cache,target=/var/lib/apt,sharing=private \
apt-get update && apt-get install -y \
ros-$ROS_DISTRO-demo-nodes-cpp \
ros-$ROS_DISTRO-nav2-bringup \
ros-$ROS_DISTRO-rmw-fastrtps-cpp \
ros-$ROS_DISTRO-rmw-cyclonedds-cpp
FROM base as fastrtps
WORKDIR /opt/fastrtps_ws
COPY --link ./fastrtps.repos ./
WORKDIR /opt/fastrtps_ws/src
RUN vcs import --input ../fastrtps.repos --shallow
WORKDIR /opt/fastrtps_ws
RUN --mount=type=cache,target=/var/cache/apt,sharing=private \
--mount=type=cache,target=/var/lib/apt,sharing=private \
. /opt/ros/$ROS_DISTRO/setup.sh && \
rosdep update --rosdistro $ROS_DISTRO && \
rosdep install -y --from-paths src --rosdistro=$ROS_DISTRO
RUN . /opt/ros/$ROS_DISTRO/setup.sh && \
colcon build
COPY --link ./fastrtps_entrypoint.sh /ros_entrypoint.sh
RUN chmod +x /ros_entrypoint.sh
# The following repos are from https://github.com/eProsima/Fast-DDS/blob/master/fastrtps.repos
repositories:
foonathan_memory_vendor:
type: git
url: https://github.com/eProsima/foonathan_memory_vendor.git
version: master
fastcdr:
type: git
url: https://github.com/eProsima/Fast-CDR.git
version: master
fastrtps:
type: git
url: https://github.com/eProsima/Fast-DDS.git
version: 526a51954d65d976b21234dc1d517044b4c19ff7 # 2.3.x
fastddsgen:
type: git
url: https://github.com/eProsima/Fast-DDS-Gen.git
version: master
fastddsgen/thirdparty/idl-parser:
type: git
url: https://github.com/eProsima/IDL-Parser.git
version: master
#!/bin/bash
set -e
# setup ros2 environment
source "/opt/fastrtps_ws/install/setup.bash"
exec "$@"
#!/usr/bin/env bash
docker buildx bake -f compose.yml --load &> /dev/null
source /opt/ros/galactic/setup.bash
RMWS='rmw_cyclonedds_cpp rmw_fastrtps_cpp'
DAEMON_COMMANDS='start stop'
run_tests() {
export RMW_IMPLEMENTATION=$1
DAEMON_COMMAND=$2
if [ "$DAEMON_COMMAND" = 'start' ]; then
DAEMON_SYMBOL="✅"
else
DAEMON_SYMBOL="❌"
fi
echo "rmw: $RMW_IMPLEMENTATION | daemon: $DAEMON_SYMBOL"
for i in {1..3}; do
echo -n " Try #$i: "
docker-compose down &> /dev/null
ros2 daemon $DAEMON_COMMAND &> /dev/null
docker-compose up -d &> /dev/null
sleep 5
docker-compose logs | grep "\[controller_server\]: Activating" &> /dev/null && echo "✅" || echo "❌"
docker-compose down &> /dev/null
ros2 daemon stop &> /dev/null
done
}
for rmw in $RMWS; do
for daemon_cmd in $DAEMON_COMMANDS; do
run_tests $rmw $daemon_cmd
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment