Skip to content

Commit

Permalink
WIP: Try to set up CycloneDDS networking between 2 docker containers …
Browse files Browse the repository at this point in the history
…on 2 hosts
  • Loading branch information
LoyVanBeek committed Dec 29, 2024
1 parent c29c8f7 commit c1e7a1c
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
20 changes: 19 additions & 1 deletion docker/docker-compose-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
# network_mode: host
ipc: host
pid: host
# Needed to display graphical applications
Expand All @@ -27,3 +27,21 @@ services:
# Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
hostname: operator-host
domainname: test
networks:
network:
ipv4_address: 192.168.178.101

networks:
network:
driver: ipvlan
driver_opts:
parent: wlo1
ipvlan-mode: l2
ipam:
driver: default
config:
- subnet: 192.168.178.0/24
gateway: 192.168.178.1
ip_range: 192.168.178.0/24
21 changes: 20 additions & 1 deletion docker/docker-compose-robot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:
stdin_open: true
tty: true
# Networking and IPC for ROS 2
network_mode: host
# network_mode: host
ipc: host
pid: host
# Needed to display graphical applications
Expand All @@ -28,8 +28,27 @@ services:
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
devices:
- /dev/ttyACM0
hostname: robot-host
domainname: test
networks:
network:
ipv4_address: 192.168.178.100

# Launch
bringup:
extends: base
command: ros2 launch neato_bringup neato.launch.py


networks:
network:
driver: ipvlan
driver_opts:
parent: enu1u1u1
ipvlan-mode: l2
ipam:
driver: default
config:
- subnet: 192.168.178.0/24
gateway: 192.168.178.1
ip_range: 192.168.178.0/24
1 change: 1 addition & 0 deletions docker/operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN apt update && apt-get install -y --no-install-recommends \
ros-humble-rmw-cyclonedds-cpp \
iproute2 \
net-tools \
iputils-ping \
&& rm -rf /var/lib/apt/lists/*

# Prepare CycloneDDS config file
Expand Down
3 changes: 2 additions & 1 deletion docker/operator/cyclonedds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Interfaces>
<NetworkInterface name="wlo1"/>
</Interfaces>
<DontRoute>true</DontRoute>
</General>
<Discovery>
<Peers>
Expand All @@ -13,4 +14,4 @@
<ParticipantIndex>auto</ParticipantIndex>
</Discovery>
</Domain>
</CycloneDDS>
</CycloneDDS>
3 changes: 2 additions & 1 deletion docker/operator/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
source /opt/ros/${ROS_DISTRO}/setup.bash

# Execute the command passed into this entrypoint
exec rviz2
# exec rviz2
/bin/bash
3 changes: 3 additions & 0 deletions docker/robot/cyclonedds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<Interfaces>
<NetworkInterface name="enu1u1u1"/>
</Interfaces>
<DontRoute>true</DontRoute>
<AllowMulticast>false</AllowMulticast>
<EnableMulticastLoopback>true</EnableMulticastLoopback>
</General>
<Discovery>
<Peers>
Expand Down

0 comments on commit c1e7a1c

Please sign in to comment.