This commit is contained in:
Björn Ellensohn 2023-08-24 12:41:03 +02:00
parent d0f16e6701
commit cf0fd9e1f1
4 changed files with 170 additions and 88 deletions

View File

@ -1,14 +1,26 @@
version: "3.9" version: "3.9"
services: # in docker compose, service are definitions of your docker containers services: # in docker compose, service are definitions of your docker containers
my_example: # for this example I am using a very simple docker build for reference: hello-world
image: hello-world # hello-world image. No prefix means it defaults the image registry to dockerhub
build:
context: .
dockerfile: docker/my_example.Dockerfile # the Dockerfile speciefies the steps taken in the build process.
target: hello-world # here you specify the build target in the Dockerfile
x-bake: # Definitions needed for buildx bake. This enhanced docker build system makes things much easier.
platforms:
#- linux/arm64 uncomment if arm64 platform is needed (like jetson nano or raspberry pi)
- linux/amd64
# Base image containing dependencies for example the robot controller # Base image containing dependencies for example the robot controller
base: base:
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:base # this will be the output image tag image: ghcr.io/bjoernellens1/ros2_rmp/rmp:base # this will be the output image tag
build: build:
context: . context: .
dockerfile: docker/Dockerfile # the Dockerfilespeciefies the steps taken in the build process. dockerfile: docker/Dockerfile # the Dockerfilespeciefies the steps taken in the build process.
args: args: # specify build arguments. May use them to alter the build process.
ROS_DISTRO: humble ROS_DISTRO: humble # For instance you could change to foxy here.
target: base # here you specify the build target in the Dockerfile target: base # here you specify the build target in the Dockerfile
x-bake: x-bake:
platforms: platforms:
@ -75,17 +87,13 @@ services: # in docker compose, service are definitions of your docker containers
# The following service definitions do not include build instructions as they do not require additional content in the images. Meaning, if you already have the image locally, everything's fine. If you don't have the image locally, docker compose will download the image from the image registry for you. If docker compose does not have access to the image registry, it will build the corresponding image for you (so better make sur you have access). # The following service definitions do not include build instructions as they do not require additional content in the images. Meaning, if you already have the image locally, everything's fine. If you don't have the image locally, docker compose will download the image from the image registry for you. If docker compose does not have access to the image registry, it will build the corresponding image for you (so better make sur you have access).
# You can see these service definitions as an easy way to spin up separate containers for launching separate tasks. I use this to control the current operational mode of the robot (mapping or navigation an localization). In the end it's just spinning up launch files in separate containers. # You can see these service definitions as an easy way to spin up separate containers for launching separate tasks. I use this to control the current operational mode of the robot (mapping or navigation an localization). In the end it's just spinning up launch files in separate containers.
# Note that service definitions will always inherit the preferences from their "parent" service. However, you can overwrite them.
# Robot State Publisher # Robot State Publisher
rsp: rsp:
extends: overlay extends: overlay
command: > command: >
ros2 launch cps_rmp220_support rsp.launch.py ros2 launch cps_rmp220_support rsp.launch.py
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -96,16 +104,6 @@ services: # in docker compose, service are definitions of your docker containers
ros2 run segwayrmp SmartCar --ros-args -r cmd_vel:=cmd_vel_out -p serial_full_name:=/dev/ttyUSB0 ros2 run segwayrmp SmartCar --ros-args -r cmd_vel:=cmd_vel_out -p serial_full_name:=/dev/ttyUSB0
devices: devices:
- /dev/ttyUSB0:/dev/ttyUSB0 - /dev/ttyUSB0:/dev/ttyUSB0
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# Needed to display graphical applications
privileged: true
# depends_on:
# - robot_state_publisher
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
restart: unless-stopped restart: unless-stopped
@ -117,14 +115,6 @@ services: # in docker compose, service are definitions of your docker containers
ros2 launch rmp220_teleop robot_joystick.launch.py ros2 launch rmp220_teleop robot_joystick.launch.py
devices: devices:
- /dev/input/js0:/dev/input/js0 - /dev/input/js0:/dev/input/js0
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# Needed to display graphical applications
privileged: true
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -133,14 +123,6 @@ services: # in docker compose, service are definitions of your docker containers
extends: overlay extends: overlay
command: > command: >
ros2 launch cps_rmp220_support robot_lidar.launch.py serial_port:=/dev/ttyUSB0 ros2 launch cps_rmp220_support robot_lidar.launch.py serial_port:=/dev/ttyUSB0
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# depends_on:
# - robot_state_publisher
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
devices: devices:
@ -152,12 +134,6 @@ services: # in docker compose, service are definitions of your docker containers
extends: overlay extends: overlay
command: > command: >
ros2 launch cps_rmp220_support robot_localization.launch.py ros2 launch cps_rmp220_support robot_localization.launch.py
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -166,12 +142,6 @@ services: # in docker compose, service are definitions of your docker containers
extends: overlay extends: overlay
command: > command: >
ros2 launch cps_rmp220_support robot_mapping.launch.py ros2 launch cps_rmp220_support robot_mapping.launch.py
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -180,12 +150,6 @@ services: # in docker compose, service are definitions of your docker containers
extends: overlay extends: overlay
command: > command: >
ros2 launch cps_rmp220_support robot_mapping_localization.launch.py map_file_name:=/repo/maps/map.yaml ros2 launch cps_rmp220_support robot_mapping_localization.launch.py map_file_name:=/repo/maps/map.yaml
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -194,12 +158,6 @@ services: # in docker compose, service are definitions of your docker containers
extends: overlay extends: overlay
command: > command: >
ros2 launch cps_rmp220_support robot_amcl.launch.py map:=/repo/maps/map.yaml ros2 launch cps_rmp220_support robot_amcl.launch.py map:=/repo/maps/map.yaml
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -209,11 +167,6 @@ services: # in docker compose, service are definitions of your docker containers
command: > command: >
ros2 launch cps_rmp220_support robot_navigation.launch.py ros2 launch cps_rmp220_support robot_navigation.launch.py
map_subscribe_transient_local:=true map_subscribe_transient_local:=true
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
@ -222,38 +175,14 @@ services: # in docker compose, service are definitions of your docker containers
extends: overlay extends: overlay
command: > command: >
/bin/bash /bin/bash
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
devices:
- /dev/input/js0:/dev/input/js0
environment: environment:
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
# rviz2 # rviz2
rviz2: rviz2:
extends: guis extends: guis
# command: >
# ros2 launch cps_rmp220_support robot_rviz2.launch.py
command: > command: >
ros2 launch cps_rmp220_support rviz.launch.py ros2 launch cps_rmp220_support rviz.launch.py
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
ipc: host
# Needed to display graphical applications
privileged: true
environment: environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority

View File

@ -0,0 +1,114 @@
# explicitly use Debian for maximum cross-architecture compatibility
FROM debian:bullseye-slim AS hello-world
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gnupg \
wget \
\
gcc \
libc6-dev \
make \
\
libc6-dev-arm64-cross \
libc6-dev-armel-cross \
libc6-dev-armhf-cross \
libc6-dev-i386-cross \
libc6-dev-mips64el-cross \
libc6-dev-ppc64el-cross \
libc6-dev-riscv64-cross \
libc6-dev-s390x-cross \
\
gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabi \
gcc-arm-linux-gnueabihf \
gcc-i686-linux-gnu \
gcc-mips64el-linux-gnuabi64 \
gcc-powerpc64le-linux-gnu \
gcc-riscv64-linux-gnu \
gcc-s390x-linux-gnu \
\
arch-test \
file \
; \
rm -rf /var/lib/apt/lists/*
# https://musl.libc.org/releases.html
ENV MUSL_VERSION 1.2.4
RUN set -eux; \
wget -O musl.tgz.asc "https://musl.libc.org/releases/musl-$MUSL_VERSION.tar.gz.asc"; \
wget -O musl.tgz "https://musl.libc.org/releases/musl-$MUSL_VERSION.tar.gz"; \
\
export GNUPGHOME="$(mktemp -d)"; \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys '836489290BB6B70F99FFDA0556BCDB593020450F'; \
gpg --batch --verify musl.tgz.asc musl.tgz; \
gpgconf --kill all; \
rm -rf "$GNUPGHOME" musl.tgz.asc; \
\
mkdir /usr/local/src/musl; \
tar --extract --file musl.tgz --directory /usr/local/src/musl --strip-components 1; \
rm musl.tgz
WORKDIR /usr/src/hello
COPY . .
RUN set -ex; \
make clean all test \
TARGET_ARCH='amd64' \
CROSS_COMPILE='x86_64-linux-gnu-' \
ARCH_TEST='amd64'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm32v5' \
CROSS_COMPILE='arm-linux-gnueabi-' \
ARCH_TEST='armel'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm32v7' \
CROSS_COMPILE='arm-linux-gnueabihf-' \
ARCH_TEST='armhf'
RUN set -ex; \
make clean all test \
TARGET_ARCH='arm64v8' \
CROSS_COMPILE='aarch64-linux-gnu-' \
ARCH_TEST='arm64'
RUN set -ex; \
make clean all test \
TARGET_ARCH='i386' \
CROSS_COMPILE='i686-linux-gnu-' \
ARCH_TEST='i386'
RUN set -ex; \
make clean all test \
TARGET_ARCH='mips64le' \
CROSS_COMPILE='mips64el-linux-gnuabi64-' \
ARCH_TEST='mips64el'
RUN set -ex; \
make clean all test \
TARGET_ARCH='ppc64le' \
CROSS_COMPILE='powerpc64le-linux-gnu-' \
CFLAGS+='-mlong-double-64' \
ARCH_TEST='ppc64el'
RUN set -ex; \
make clean all test \
TARGET_ARCH='riscv64' \
CROSS_COMPILE='riscv64-linux-gnu-' \
ARCH_TEST='riscv64'
RUN set -ex; \
make clean all test \
TARGET_ARCH='s390x' \
CROSS_COMPILE='s390x-linux-gnu-' \
ARCH_TEST='s390x'
RUN find \( -name 'hello' -or -name 'hello.txt' \) -exec file '{}' + -exec ls -lh '{}' +
CMD ["./amd64/hello-world/hello"]

28
my.repos Normal file
View File

@ -0,0 +1,28 @@
repositories:
# CPS RMP lite 220 Dependencies
segwayrmp:
type: git
url: https://github.com/bjoernellens1/segwayrmp
version: humble
segway_msgs:
type: git
url: https://github.com/bjoernellens1/segway_msgs
version: main
RPlidar_ROS2:
type: git
url: https://github.com/bjoernellens1/sllidar_ros2
version: main
rmp220_teleop:
type: git
url: https://github.com/bjoernellens1/rmp220_teleop.git
version: main
rmp220_middleware:
type: git
url: https://github.com/bjoernellens1/rmp220_middleware.git
version: main

11
my_extended.repos Normal file
View File

@ -0,0 +1,11 @@
repositories:
cps_rmp220_support:
type: git
url: https://github.com/bjoernellens1/cps_rmp220_support.git
version: main
cam_openCV:
type: git
url: https://github.com/bjoernellens1/ros2_cam_openCV.git
version: main