Skip to content

Commit

Permalink
ROS_LOCALHOST_ONLY=1 : don't force multicast on lo (fix #12)
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Nov 6, 2023
1 parent 7884398 commit f5f20c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,26 @@ A typical usage is to run 1 bridge in a robot, and 1 bridge in another host moni
It's important to make sure that NO DDS communication can occur between 2 hosts that are bridged by `zenoh-bridge-ros2dds`. Otherwise, some duplicate or looping traffic can occur.
To make sure of this, you can either:
- define `ROS_LOCALHOST_ONLY=1`
- define `ROS_LOCALHOST_ONLY=1`.
Preferably, enable MULTICAST on the loopback interface with this command (on Linux): `sudo ip l set lo multicast on`
- use different `ROS_DOMAIN_ID` on each hosts
- use a `CYCLONEDDS_URI` that configures CycloneDDS to only use internal interfaces to the robot.
For instance for Turtlebot4 which embedds 2 hosts interconnected via USB:
- use a `CYCLONEDDS_URI` that configures CycloneDDS to only use internal interfaces to the robot. This configuration has to be used for all ROS Nodes as well as for the bridge.
For instance for Turtlebot4 which embeds 2 hosts interconnected via USB:
```xml
<CycloneDDS>
<Domain>
<General>
<Interfaces>
<NetworkInterface name="usb0" priority="default" multicast="default"/>
<NetworkInterface address="127.0.0.1" multicast="true"/>
<NetworkInterface name="usb0"/>
<!-- For less traffic, force multicast usage on loopback even if not configured. -->
<!-- All ROS Nodes and bridges must have this same config, otherwise they won't discover -->
<NetworkInterface address="127.0.0.1" multicast="true"/>
</Interfaces>
<DontRoute>true</DontRoute>
</General>
</Domain>
</CycloneDDS>
```
```

On the robot, run:
- `zenoh-bridge-dds -l tcp/0.0.0.0:7447`
Expand All @@ -125,7 +128,6 @@ On the operating host run:
- `ros2 action list`



Other interconnectivity between the 2 bridges can be configured (e.g. automatic discovery via UDP multicast, interconnection via 1 or more Zenoh routers...).
See the [Zenoh documentation](https://zenoh.io/docs/getting-started/deployment/) to learn more about the possibile deployments allowed by Zenoh.

Expand Down
2 changes: 1 addition & 1 deletion zenoh-plugin-ros2dds/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ zenoh::kedefine!(
// CycloneDDS' localhost-only: set network interface address (shortened form of config would be
// possible, too, but I think it is clearer to spell it out completely).
// Empty configuration fragments are ignored, so it is safe to unconditionally append a comma.
const CYCLONEDDS_CONFIG_LOCALHOST_ONLY: &str = r#"<CycloneDDS><Domain><General><Interfaces><NetworkInterface address="127.0.0.1" multicast="true"/></Interfaces></General></Domain></CycloneDDS>,"#;
const CYCLONEDDS_CONFIG_LOCALHOST_ONLY: &str = r#"<CycloneDDS><Domain><General><Interfaces><NetworkInterface address="127.0.0.1"/></Interfaces></General></Domain></CycloneDDS>,"#;

// CycloneDDS' enable-shm: enable usage of Iceoryx shared memory
#[cfg(feature = "dds_shm")]
Expand Down

0 comments on commit f5f20c0

Please sign in to comment.