This commit is contained in:
Björn Ellensohn 2023-11-14 14:55:16 +01:00
parent 6d5f14919d
commit 8eed831ce1
3 changed files with 66 additions and 4 deletions

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" ?>
<CycloneDDS xmlns="https://cdds.io/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://cdds.io/config https://raw.githubusercontent.com/eclipse-cyclonedds/cyclonedds/master/etc/cyclonedds.xsd">
<Domain id="any">
<General>
<NetworkInterfaceAddress>zt3jn7jpga</NetworkInterfaceAddress>
<AllowMulticast>true</AllowMulticast>
<FragmentSize>1194B</FragmentSize><!-- default: 1344 B minus Husarnet metadata (~150 B) -->
<Transport>udp6</Transport>
</General>
<Discovery>
<Peers>
</Peers>
<ParticipantIndex>auto</ParticipantIndex>
<MaxAutoParticipantIndex>40</MaxAutoParticipantIndex>
</Discovery>
<Internal>
<Watermarks>
<WhcHigh>500kB</WhcHigh>
</Watermarks>
</Internal>
<Tracing>
<Verbosity>severe</Verbosity>
<OutputFile>stdout</OutputFile>
</Tracing>
</Domain>
</CycloneDDS>

View File

@ -53,12 +53,46 @@ fi
# /zerotier-one/zerotier-cli join 8056c2e21c000001 # /zerotier-one/zerotier-cli join 8056c2e21c000001
# echo "Joined zerotier network" # echo "Joined zerotier network"
# fi # fi
# set standard gateway to zerotier interface # # set standard gateway to zerotier interface
ip route del default # ip route del default
ip route add default via $(ip addr show zt0 | grep -Po 'inet \K[\d.]+') # ip route add default via $(ip addr show zt* | grep -Po 'inet \K[\d.]+')
echo "Set zerotier interface as standard gateway" # echo "Set zerotier interface as standard gateway"
# this should now route the ros2 traffic through zerotier? # this should now route the ros2 traffic through zerotier?
# # Find the ZeroTier interface name dynamically
# zerotier_interface=$(ip addr show | awk '/^.*: zt/{print $2}' | cut -d ':' -f 1)
# if [ -z "$zerotier_interface" ]; then
# echo "ZeroTier interface not found."
# exit 1
# fi
# # Set the standard gateway to the ZeroTier interface
# ip route del default
# ip route add default via $(ip addr show "$zerotier_interface" | grep -Po 'inet \K[\d.]+')
# echo "Set ZeroTier interface '$zerotier_interface' as the standard gateway."
# Changing apporach to just configure the cyconedds to use the zerotier interface
# For now add respective ip apps to do the stuff below:
apt update && apt install -y iproute2
# Find the ZeroTier interface name dynamically
zerotier_interface=$(ip addr show | awk '/^.*: zt/{print $2}' | cut -d ':' -f 1)
if [ -z "$zerotier_interface" ]; then
echo "ZeroTier interface not found."
exit 1
fi
echo "Using ZeroTier interface: $zerotier_interface"
# Set the path to your CycloneDDS configuration file
config_file="/cyclonedds.xml"
# Replace the content between <NetworkInterfaceAddress> tags
sed -i "s|<NetworkInterfaceAddress>.*</NetworkInterfaceAddress>|<NetworkInterfaceAddress>$zerotier_interface</NetworkInterfaceAddress>|g" "$config_file"
# Execute the command passed into this entrypoint # Execute the command passed into this entrypoint
exec "$@" exec "$@"

View File

@ -54,11 +54,13 @@ services:
# set correct ros2 parameters: domain id and rmw implementation # set correct ros2 parameters: domain id and rmw implementation
- ROS_DOMAIN_ID=5 - ROS_DOMAIN_ID=5
- RMW_IMPLEMENTATION=rmw_cyclonedds_cpp - RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
- CYCLONEDDS_URI=file:///cyclonedds.xml
volumes: volumes:
# Allows graphical programs in the container. # Allows graphical programs in the container.
- /tmp/.X11-unix:/tmp/.X11-unix:rw - /tmp/.X11-unix:/tmp/.X11-unix:rw
- ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority - ${XAUTHORITY:-$HOME/.Xauthority}:/root/.Xauthority
- ./customize/entrypoint.sh:/entrypoint.sh - ./customize/entrypoint.sh:/entrypoint.sh
- ./customize/cyclonedds_zerotier.xml:/cyclonedds.xml
# 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. # 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: # rmp: