ros2_rmp/docker-compose.yaml

448 lines
12 KiB
YAML
Raw Normal View History

version: "3.9"
2023-08-02 13:56:21 +00:00
services:
# Base image containing dependencies.
base:
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:base
build:
context: .
2023-07-28 08:07:09 +00:00
dockerfile: docker/Dockerfile
2023-09-05 06:52:37 +00:00
tags:
- ghcr.io/bjoernellens1/ros2_rmp/rmp:base
args:
ROS_DISTRO: humble
target: base
2023-07-28 08:07:09 +00:00
x-bake:
platforms:
- linux/arm64
- linux/amd64
# Interactive shell
stdin_open: true
tty: true
# Networking and IPC for ROS 2
2023-10-05 07:05:57 +00:00
network_mode: host
ipc: host
# Needed to display graphical applications
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
2023-11-13 15:48:59 +00:00
# set correct ros2 parameters: domain id and rmw implementation
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
2023-11-14 13:55:16 +00:00
- CYCLONEDDS_URI=file:///cyclonedds.xml
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
- ./config/entrypoint.sh:/entrypoint.sh
- ./config/cyclonedds.xml:/cyclonedds.xml
2023-10-05 07:06:41 +00:00
# networks: # not using bridging anymore, instead try using all services on macvlan? let's see... shoudl word for now. Bridging does definitely not work because multicast is not supported here.
# rmp:
# #ipv4_address: 192.168.0.101 #actually don't need to set ips. they are set automatically by docker-compose. SHould be inherited by all child services.
2023-09-13 09:57:55 +00:00
2023-07-28 08:07:09 +00:00
# Overlay image containing the project specific source code.
overlay:
extends: base
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:overlay
build:
context: .
2023-07-28 08:07:09 +00:00
dockerfile: docker/Dockerfile
2023-07-28 09:11:54 +00:00
tags:
- ghcr.io/bjoernellens1/ros2_rmp/rmp:overlay
target: overlay
2023-07-28 08:07:09 +00:00
x-bake:
platforms:
- linux/arm64
- linux/amd64
2023-08-02 13:56:21 +00:00
volumes:
- .:/repo
2023-08-03 06:33:30 +00:00
command: >
/bin/bash
2023-08-02 13:56:21 +00:00
# Additional dependencies for GUI applications
guis:
extends: overlay
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:guis
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/ros2_rmp/rmp:guis
target: guis
x-bake:
platforms:
- linux/arm64
- linux/amd64
command: >
/bin/bash
2023-12-24 10:59:29 +00:00
devices:
2024-01-22 10:55:36 +00:00
- /dev/dri:/dev/dri
# Robot State Publisher
2023-08-10 07:04:23 +00:00
rsp:
extends: overlay
command: >
2023-08-08 08:51:25 +00:00
ros2 launch cps_rmp220_support rsp.launch.py
2023-07-31 08:13:01 +00:00
# Controller
controller:
2023-09-26 09:23:47 +00:00
extends: base
command: >
2023-08-28 10:16:09 +00:00
ros2 run segwayrmp SmartCar --ros-args -r cmd_vel:=cmd_vel_out -p serial_full_name:=/dev/segway
devices:
2024-01-22 10:55:36 +00:00
- /dev/segway:/dev/ttyUSB0
#- /dev/ttyUSB0:/dev/ttyUSB0
privileged: true
2023-07-31 08:13:01 +00:00
# teleop
teleop:
2023-08-18 08:03:42 +00:00
extends: base
2023-09-26 09:23:47 +00:00
depends_on:
- controller
2023-07-31 08:13:01 +00:00
command: >
ros2 launch rmp220_teleop robot_joystick.launch.py
2023-07-31 08:13:01 +00:00
devices:
- /dev/input/js0:/dev/input/js0
2024-01-22 10:55:36 +00:00
#- /dev/input/by-id/usb-Logitech_Wireless_Gamepad_F710_56679674-joystick:/dev/input/by-id/usb-Logitech_Wireless_Gamepad_F710_56679674-joystick
privileged: true
2023-07-31 08:13:01 +00:00
2023-07-31 08:07:09 +00:00
# lidar
lidar:
extends: overlay
2023-10-16 06:50:52 +00:00
depends_on:
- lidar_filter
command: >
2023-08-28 10:16:09 +00:00
ros2 launch cps_rmp220_support robot_lidar.launch.py serial_port:=/dev/rplidarA1
2023-08-09 09:58:24 +00:00
devices:
2023-08-28 10:16:09 +00:00
- /dev/rplidarA1:/dev/rplidarA1 #udevrules needed for this to work:
2024-03-28 08:53:35 +00:00
# SUBSYSTEM=="tty", ATTRS{serial}=="0001", SYMLINK+="segway"
# SUBSYSTEM=="tty", ATTRS{serial}=="3453995662b3af4f81f4a69eba5f3f29", SYMLINK+="rplidarA1"
2023-08-28 10:16:09 +00:00
2023-10-13 07:18:00 +00:00
# Lidar filtering node.
lidar_filter:
extends: overlay
command: >
2023-10-16 06:50:29 +00:00
ros2 launch cps_rmp220_support robot_scan_filter.launch.py
2023-08-22 07:05:48 +00:00
# localiaztion by ekf node
ekf:
extends: overlay
2023-09-26 09:23:47 +00:00
depends_on:
- controller
- rsp
2023-08-22 07:05:48 +00:00
command: >
ros2 launch cps_rmp220_support robot_localization.launch.py
# mapping
mapping:
extends: overlay
2023-09-26 09:23:47 +00:00
depends_on:
- ekf
- rsp
- lidar
command: >
2023-08-08 08:51:25 +00:00
ros2 launch cps_rmp220_support robot_mapping.launch.py
2023-08-29 08:04:00 +00:00
# slam-toolbox-localization
2023-08-22 10:06:18 +00:00
localization:
extends: overlay
2023-09-26 09:23:47 +00:00
depends_on:
- ekf
- rsp
- lidar
2023-08-22 10:06:18 +00:00
command: >
2023-08-23 06:32:04 +00:00
ros2 launch cps_rmp220_support robot_mapping_localization.launch.py map_file_name:=/repo/maps/map.yaml
2023-08-23 06:16:20 +00:00
2023-08-23 06:32:04 +00:00
# amcl_localization
2023-08-23 06:16:20 +00:00
amcl:
extends: overlay
2023-09-26 09:23:47 +00:00
depends_on:
- ekf
- rsp
- lidar
2023-08-23 06:16:20 +00:00
command: >
2023-08-23 06:32:04 +00:00
ros2 launch cps_rmp220_support robot_amcl.launch.py map:=/repo/maps/map.yaml
2023-08-22 10:06:18 +00:00
# navigation
navigation:
extends: overlay
2023-10-04 12:11:22 +00:00
depends_on:
- controller
- teleop
- rsp
- lidar
- ekf
- oakd
command: >
ros2 launch nav2_bringup bringup_launch.py slam:=True map:=/repo/maps/map.yaml use_sim_time:=False use_composition:=True params_file:=/repo/config/nav2_params.yaml
#maps/map_openlabday.yaml
2023-07-28 09:36:43 +00:00
# bash
bash:
extends: overlay
command: >
/bin/bash
2023-08-02 13:56:21 +00:00
# rviz2
rviz2:
2023-09-13 11:59:17 +00:00
#extends: guis
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:guis
2023-08-02 13:56:21 +00:00
command: >
2023-08-22 06:34:05 +00:00
ros2 launch cps_rmp220_support rviz.launch.py
2023-08-02 13:56:21 +00:00
# Needed to display graphical applications
2023-11-13 15:48:59 +00:00
privileged: true # really necessary?
2023-08-02 13:56:21 +00:00
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
2023-08-08 09:37:57 +00:00
- ROS_DOMAIN_ID=5
2023-08-31 09:30:00 +00:00
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
2023-08-02 13:56:21 +00:00
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
2023-08-29 07:07:28 +00:00
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
2023-09-13 11:59:17 +00:00
2023-08-29 08:04:00 +00:00
# Foxglove Studio Bridge
2023-08-29 07:35:01 +00:00
foxglove_bridge:
2023-08-29 08:04:00 +00:00
extends: overlay
2023-08-29 07:07:28 +00:00
command: >
ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:=8765
2023-08-29 07:35:01 +00:00
# Foxglove Studio Webserver
foxglove:
2023-08-29 07:35:01 +00:00
image: ghcr.io/foxglove/studio:latest
stdin_open: true
tty: true
# Networking
2024-03-28 08:53:35 +00:00
networks:
- caddy_network
2023-08-29 07:35:01 +00:00
ports:
- 8080:8080
2023-09-14 09:08:37 +00:00
depends_on:
- foxglove_bridge
2023-09-14 09:48:39 +00:00
volumes:
2024-03-28 08:46:50 +00:00
- ./config/foxglove/default.json:/foxglove/default-layout.json
2023-08-29 09:17:44 +00:00
# USB Camera Stream
2024-03-29 09:43:00 +00:00
# cam:
# extends: overlay
# command: >
# ros2 run ros2_cam_openCV cam_node
# devices:
# - /dev/video0:/dev/video0
# cam:
# extends: overlay
# command: >
# ros2 launch ffmpeg_image_transport cam.launch.py
# devices:
# - /dev/video0:/dev/video0
# - /dev/dri:/dev/dri
webcam:
2023-08-29 09:17:44 +00:00
extends: overlay
2024-03-29 09:43:00 +00:00
image: husarion/image-transport:humble-4.2.0
2023-08-29 09:17:44 +00:00
devices:
- /dev/video0:/dev/video0
2024-03-29 09:43:00 +00:00
- /dev/dri:/dev/dri
volumes:
- ./:/repo
command: >
ros2 launch /repo/webcam.launch.py
ffmpeg_encoding:=libx264
ffmpeg_preset:=ultrafast
ffmpeg_tune:=zerolatency
2023-09-05 06:52:37 +00:00
2023-09-14 06:36:30 +00:00
# ROS2 Frontier exploration
explorer:
extends: overlay
2023-09-26 09:23:47 +00:00
depends_on:
- controller
- teleop
- rsp
- lidar
- ekf
- navigation
2023-09-14 06:36:30 +00:00
command: >
ros2 launch cps_rmp220_support robot_exploration.launch.py
### Images for ROS1 Interactions
2023-09-05 06:52:37 +00:00
#ROS1 Bridge
2024-03-28 08:53:35 +00:00
# ros1bridge:
# image: ghcr.io/bjoernellens1/ros2_rmp/ros1bridge
# command: >
# ros2 run ros1_bridge dynamic_bridge --bridge-all-2to1-topics
# build:
# context: .
# dockerfile: docker/Dockerfile
# tags:
# - ghcr.io/bjoernellens1/ros2_rmp/ros1bridge
# args:
# ROS_DISTRO: humble
# target: bridge
# x-bake:
# platforms:
# #- linux/arm64
# - linux/amd64
# # Networking and IPC for ROS 2
# network_mode: host
# ipc: host
# environment:
# - ROS_DOMAIN_ID=5
# - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# - ROS_MASTER_URI=http://localhost:11311 # is configured to run roscore on the robot but could change to local ros1 machine here
2023-09-05 06:52:37 +00:00
#ROS1 roscore
2024-03-28 08:53:35 +00:00
# roscore:
# command: >
# roscore
# extends: ros1bridge
# network_mode: host
# ipc: host
# environment:
# - ROS_DOMAIN_ID=5
# - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# - ROS_MASTER_URI=http://localhost:11311 # is configured to run roscore on the robot but could change to local ros1 machine here
2023-09-18 10:02:15 +00:00
2024-01-25 09:11:39 +00:00
## Configure on ROS1 Hosts
# seggy 192.168.0.100
# locally running ros-package: control1
# subscribing topic2
# publishing topic1
# robot2 192.168.x.x
# locally running ros-package: control2
# subscribing topic1
# publishing topic2
# As we need one ros-master to control the communication, we choose 192.168.1.1 as master. Therefore we execute locally on robot 1:
# export ROS_MASTER_URI=http://192.168.0.100:11311 # or localhost?
# export ROS_HOSTNAME=192.168.0.100
# export ROS_IP=192.168.0.100
# roscore
# In order to connect to the ROS-master, we execute locally on robot2:
# export ROS_MASTER_URI=http://192.1.1.1:11311
# export ROS_IP=192.168.1.2
# export ROS_HOSTNAME=192.168.1.2
2023-09-18 10:02:15 +00:00
# ROS2 oak-d-lite camera
oakd:
extends: overlay
command: >
ros2 launch depthai_examples stereo.launch.py
2023-09-21 07:51:45 +00:00
#devices:
2023-09-19 08:18:54 +00:00
#- /dev/oakd-lite:/dev/oakd-lite # need corresponding udevrules for this to work:
2023-09-18 10:29:01 +00:00
# SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666", SYMLINK+="oakd-lite"
2023-09-21 07:51:45 +00:00
#- /dev/:/dev/
device_cgroup_rules:
- 'c 189:* rmw'
volumes:
- /dev/bus/usb:/dev/bus/usb
2023-09-21 07:37:57 +00:00
2023-09-21 07:51:45 +00:00
# for testing the oak-d-lite camera -> works now with cgroup rules
2023-09-21 07:37:57 +00:00
depthai:
image: luxonis/depthai:latest
command: >
python3 /depthai/depthai_demo.py
stdin_open: true
tty: true
2023-09-21 07:49:05 +00:00
device_cgroup_rules:
- 'c 189:* rmw'
volumes:
- /dev/bus/usb:/dev/bus/usb
2023-09-21 07:37:57 +00:00
environment:
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
2024-03-28 08:53:35 +00:00
################################################################################################################################
# Core Services for Web Management #
################################################################################################################################
caddy:
image: caddy:latest
networks:
- caddy_network
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "80:80"
- "443:443"
volumes:
2024-03-28 08:53:35 +00:00
- ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
- ./config/caddy/content:/usr/share/caddy/
restart: always
depends_on:
- foxglove
- olivetin
roscore:
image: husarion/ros1-bridge:foxy-0.9.6-20230327-stable
command: |
bash -c "source /opt/ros/noetic/setup.bash && roscore"
network_mode: host
environment:
2024-03-28 08:53:35 +00:00
- ROS_DOMAIN_ID=5
restart: always
ros1bridge:
image: husarion/ros1-bridge:foxy-0.9.6-20230327-stable
command: |
2024-03-29 09:43:00 +00:00
sh /opt/ros/noetic/setup.sh && ros2 run ros1_bridge dynamic_bridge
2024-03-28 08:53:35 +00:00
network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
restart: always
webui-joystick:
image: husarion/webui-ros-joystick:noetic-0.0.1-20230510-stable
network_mode: host
# networks:
# - caddy_network
# ports:
# - 8000:8000
ipc: host
environment:
- ROS_DOMAIN_ID=5
restart: always
2024-03-29 10:22:52 +00:00
#depends_on:
# - ros1bridge
2024-03-28 08:53:35 +00:00
command: roslaunch webui-ros-joystick webui.launch
olivetin:
container_name: olivetin
image: jamesread/olivetin
#image: ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin
build:
context: .
dockerfile: docker/Dockerfile
tags:
- ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin
target: olivetin
x-bake:
platforms:
#- linux/arm64
- linux/amd64
user: root
privileged: true
volumes:
- ./config/olivetin/:/config/ # here is config.yaml and icons located
- ./config/olivetin/icons:/var/www/olivetin/customIcons
- .:/repo
- /var/run/docker.sock:/var/run/docker.sock
# - /var/lib/docker:/var/lib/docker
- ~/.ssh/id_rsa:/root/.ssh/id_rsa
networks:
- caddy_network
ports:
- "1337:1337"
restart: always
################################################################################################################################
# Docker related extra stuff #
################################################################################################################################
networks:
caddy_network:
driver: bridge