some cleanup

This commit is contained in:
Björn Ellensohn 2023-11-13 16:48:59 +01:00
parent 48b267bb54
commit b014d836a7
2 changed files with 72 additions and 157 deletions

64
customize/entrypoint.sh Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
# Basic entrypoint for ROS / Colcon Docker containers
UNDERLAY_WS=/rmp_ws
# Source ROS 2
source /opt/ros/${ROS_DISTRO}/setup.bash
echo "Sourced ROS 2 ${ROS_DISTRO}"
# Source the base workspace, if built
if [ -f ${UNDERLAY_WS}/install/setup.bash ]
then
source ${UNDERLAY_WS}/install/setup.bash
vcs pull ${UNDERLAY_WS}/src
echo "Sourced CPS RMP 220 base workspace"
fi
# Source the overlay workspace, if built
if [ -f /overlay_ws/install/setup.bash ]
then
source /overlay_ws/install/setup.bash
vcs pull /overlay_ws/src
echo "Sourced CPS RMP 220 Overlay workspace"
fi
# Source the bridge workspace, if built
if [ -f ~/ros2_humble/install/setup.bash ]
then
source ~/ros2_humbleinstall/setup.bash
#export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$(ros2 pkg prefix turtlebot3_gazebo)/share/turtlebot3_gazebo/models
echo "Sourced CPS RMP 220 base workspace"
fi
# Implement updating all repositories at launch
if [ -f ${UNDERLAY_WS}/]
then
cd ${UNDERLAY_WS}
vcs pull src
echo "Updated base workspace"
fi
if [ -f /overlay_ws/]
then
cd /overlay_ws
vcs pull src
echo "Updated overlay workspace"
fi
# configure container networking to use zerotier interface as standard gateway
# this might be for later
# if [ -f /zerotier-one/zerotier-cli ]
# then
# /zerotier-one/zerotier-cli join 8056c2e21c000001
# echo "Joined zerotier network"
# fi
# set standard gateway to zerotier interface
ip route del default
ip route add default via $(ip addr show zt0 | grep -Po 'inet \K[\d.]+')
echo "Set zerotier interface as standard gateway"
# this should now route the ros2 traffic through zerotier?
# Execute the command passed into this entrypoint
exec "$@"

View File

@ -20,6 +20,9 @@ networks:
# config:
# - subnet:
# add this mountpoint to all services: ./customize/entrypoint.sh:/entrypoint.sh
# Attention: child services will inherit settings from their parents. So if you set a network_mode: host in the base service, all child services will also use host networking. This is not always what you want. So be careful with this.
services:
# Base image containing dependencies.
base:
@ -36,7 +39,6 @@ services:
platforms:
- linux/arm64
- linux/amd64
# Interactive shell
stdin_open: true
tty: true
@ -44,16 +46,19 @@ services:
network_mode: host
ipc: host
# Needed to display graphical applications
#privileged: true
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
- QT_X11_NO_MITSHM=1
- NVIDIA_DRIVER_CAPABILITIES=all
# set correct ros2 parameters: domain id and rmw implementation
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
volumes:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
- ./customize/entrypoint.sh:/entrypoint.sh
# 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:
@ -92,7 +97,6 @@ services:
platforms:
- linux/arm64
- linux/amd64
#entrypoint: /bin/bash
command: >
/bin/bash
@ -101,14 +105,6 @@ services:
extends: overlay
command: >
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:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# Controller
controller:
@ -118,19 +114,6 @@ services:
devices:
- /dev/segway:/dev/segway
- /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: false
# depends_on:
# - robot_state_publisher
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# teleop
teleop:
@ -141,17 +124,6 @@ services:
ros2 launch rmp220_teleop robot_joystick.launch.py
devices:
- /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:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# lidar
lidar:
@ -160,16 +132,6 @@ services:
- lidar_filter
command: >
ros2 launch cps_rmp220_support robot_lidar.launch.py serial_port:=/dev/rplidarA1
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
# depends_on:
# - robot_state_publisher
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
devices:
- /dev/rplidarA1:/dev/rplidarA1 #udevrules needed for this to work:
# SUBSYSTEM=="tty", ATTRS{serial}=="0001", SYMLINK+="segway"
@ -180,14 +142,6 @@ services:
extends: overlay
command: >
ros2 launch cps_rmp220_support robot_scan_filter.launch.py
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# localiaztion by ekf node
ekf:
@ -197,15 +151,6 @@ services:
- rsp
command: >
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:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# mapping
mapping:
@ -216,15 +161,6 @@ services:
- lidar
command: >
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:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# slam-toolbox-localization
localization:
@ -235,15 +171,6 @@ services:
- lidar
command: >
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:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# amcl_localization
amcl:
@ -254,15 +181,6 @@ services:
- lidar
command: >
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:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# navigation
navigation:
@ -274,52 +192,23 @@ services:
- lidar
- ekf
- oakd
# command: >
# ros2 launch cps_rmp220_support robot_navigation.launch.py
# map_subscribe_transient_local:=true
# command: >
# ros2 launch nav2_bringup bringup_launch.py slam:=True map:=/repo/maps/map_current.sav.yaml use_sim_time:=False use_composition:=True params_file:=/overlay_ws/src/cps_rmp220_support/config/nav2_params.yaml
command: >
ros2 launch nav2_bringup bringup_launch.py slam:=False map:=/repo/maps/map_openlabday.yaml use_sim_time:=False use_composition:=True params_file:=/overlay_ws/src/cps_rmp220_support/config/nav2_params.yaml
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# bash
bash:
extends: overlay
command: >
/bin/bash
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# rviz2
rviz2:
#extends: guis
image: ghcr.io/bjoernellens1/ros2_rmp/rmp:guis
# command: >
# ros2 launch cps_rmp220_support robot_rviz2.launch.py
command: >
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
privileged: true # really necessary?
environment:
# Allows graphical programs in the container.
- DISPLAY=${DISPLAY}
@ -337,18 +226,6 @@ services:
extends: overlay
command: >
ros2 launch foxglove_bridge foxglove_bridge_launch.xml port:=8765
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# 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.201 #actually don't need to set ips. they are set automatically by docker-compose. SHould be inherited by all child services.
# Foxglove Studio Webserver
foxglove_webserver:
@ -369,14 +246,6 @@ services:
extends: overlay
command: >
ros2 run ros2_cam_openCV cam_node
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
devices:
- /dev/video0:/dev/video0
@ -393,14 +262,6 @@ services:
- navigation
command: >
ros2 launch cps_rmp220_support robot_exploration.launch.py
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
### Images for ROS1 Interactions
#ROS1 Bridge
@ -446,15 +307,6 @@ services:
extends: overlay
command: >
ros2 launch depthai_examples stereo.launch.py
stdin_open: true
tty: true
# Networking and IPC for ROS 2
#network_mode: host
ipc: host
environment:
- ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
#privileged: true
#devices:
#- /dev/oakd-lite:/dev/oakd-lite # need corresponding udevrules for this to work:
# SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666", SYMLINK+="oakd-lite"
@ -463,7 +315,6 @@ services:
- 'c 189:* rmw'
volumes:
- /dev/bus/usb:/dev/bus/usb
# for testing the oak-d-lite camera -> works now with cgroup rules
depthai: