Files
agv_pro_ros2/docker-compose.yml

68 lines
2.6 KiB
YAML

services:
agv_pro:
build:
context: .
dockerfile: Dockerfile
platforms:
- linux/amd64
image: agv_pro_ros2
container_name: agv_pro_ros2
# network_mode: host is required so the container can see the physical can0/serial
# devices, but that also puts DDS discovery on every host interface (including wifi) by
# default. ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST keeps all DDS discovery/multicast
# traffic confined to loopback (every node here runs in this one container anyway), so
# it never reaches the host's wireless NIC.
network_mode: host
ipc: host
devices:
# On target hardware a udev rule creates /dev/agvpro_controller; override
# AGV_PRO_SERIAL_DEVICE (e.g. to /dev/ttyUSB0) when that symlink isn't present.
- "${AGV_PRO_SERIAL_DEVICE:-/dev/agvpro_controller}:/dev/agvpro_controller"
group_add:
- dialout
environment:
- ROS_DOMAIN_ID=0
- ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST
stdin_open: true
tty: true
command: bash
# Wheels driven directly over CAN using the RobStride private protocol (confirmed against
# real hardware via live CAN probing - NOT CANopen) via the community robstride_ros2
# package. IMU/voltage/digital-IO/LED stay on the serial base controller, same as the
# default `agv_pro` service above, so /dev/agvpro_controller is still mapped.
#
# Power-on sequencing: the launch-level can_power_on.py pre-step (run before
# controller_manager starts) does the serial POWER_ON handshake and then brings the CAN
# link up itself, so the kernel driver just needs to be loaded beforehand, e.g. for a
# native gs_usb/candleLight-class adapter:
# sudo modprobe gs_usb
# Do NOT run `ip link set can0 up` yourself.
# network_mode: host means the container automatically sees the host's can0 once it's up —
# no device mapping is needed for the CAN interface itself.
agv_pro_can:
build:
context: .
dockerfile: Dockerfile
platforms:
- linux/amd64
image: agv_pro_ros2
container_name: agv_pro_ros2_can
# See the agv_pro service above re: ROS_AUTOMATIC_DISCOVERY_RANGE/wifi isolation.
network_mode: host
ipc: host
devices:
# See the agv_pro service above re: AGV_PRO_SERIAL_DEVICE.
- "${AGV_PRO_SERIAL_DEVICE:-/dev/agvpro_controller}:/dev/agvpro_controller"
group_add:
- dialout
cap_add:
- NET_ADMIN
- NET_RAW
environment:
- ROS_DOMAIN_ID=0
- ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST
stdin_open: true
tty: true
command: bash