Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example for multi-host communication using fastdds #654

Open
wants to merge 2 commits into
base: messaging_refactor_release2nd
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# FASTDDS Talking on Multi-hosts

This doc is the guide for users to test fastdds channel communication on multi-hosts.

Please follow the [guide](https://fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/simple.html) and you could implement your own applications and create your own `profile.xml` files to enbale multi-host communication.

As device limit, this example has only been tested on 2 docker env on a same host machine.

## Example

There are two profiles, one for data sender and the other for reciever.

After enabling lava env with FASTDDS_Backend on 2 machines following `README.md`, modify `reciever_profile.xml` and `sender_profile.xml` to make the `locator` ip address and port aligned with another machine's ip and port.

Then, please enable `reciever_profile.xml` on the machine which will be data reciever.

```
$ export FASTRTPS_DEFAULT_PROFILES_FILE=profile.xml

$ export RMW_FASTRTPS_USE_QOS_FROM_XML=1
```
Then run the test,

```
$ python test_fastdds_from_ros.py
```

And enable `sender_profile.xml` on the machine which will be data sender.


```
$ export FASTRTPS_DEFAULT_PROFILES_FILE=profile.xml

$ export RMW_FASTRTPS_USE_QOS_FROM_XML=1
```

Then run the test,

```
$ python test_fastdds_to_ros.py
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<profiles>
<transport_descriptors>
<transport_descriptor>
<transport_id>TransportUDPv4</transport_id>
<type>UDPv4</type>
<non_blocking_send>true</non_blocking_send>
<maxInitialPeersRange>100</maxInitialPeersRange>
<output_port>7412</output_port>
</transport_descriptor>
</transport_descriptors>

<participant profile_name="participant_profile_ros2" is_default_profile="true">
<rtps>
<name>profile_for_ros2_context</name>
<builtin>
<discovery_config>
<initialAnnouncements>
<count>5</count>
<period>
<nanosec>100000000</nanosec>
</period>
</initialAnnouncements>

<EDP>SIMPLE</EDP>
<simpleEDP>
<PUBWRITER_SUBREADER>false</PUBWRITER_SUBREADER>
<PUBREADER_SUBWRITER>true</PUBREADER_SUBWRITER>
</simpleEDP>
</discovery_config>
<initialPeersList>
<locator>
<udpv4>
<address>173.16.0.3</address>
<port>7412</port>
</udpv4>
</locator>
</initialPeersList>
</builtin>
<userTransports>
<transport_id>TransportUDPv4</transport_id>
</userTransports>
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<profiles>
<transport_descriptors>
<transport_descriptor>
<transport_id>TransportUDPv4</transport_id>
<type>UDPv4</type>
<non_blocking_send>true</non_blocking_send>
<maxInitialPeersRange>100</maxInitialPeersRange>
<output_port>7412</output_port>
</transport_descriptor>
</transport_descriptors>

<participant profile_name="participant_profile_ros2" is_default_profile="true">
<rtps>
<name>profile_for_ros2_context</name>
<builtin>
<discovery_config>
<initialAnnouncements>
<count>5</count>
<period>
<nanosec>100000000</nanosec>
</period>
</initialAnnouncements>

<EDP>SIMPLE</EDP>
<simpleEDP>
<PUBWRITER_SUBREADER>true</PUBWRITER_SUBREADER>
<PUBREADER_SUBWRITER>false</PUBREADER_SUBWRITER>
</simpleEDP>
</discovery_config>
<initialPeersList>
<locator>
<udpv4>
<address>173.16.0.2</address>
<port>7412</port>
</udpv4>
</locator>
</initialPeersList>
</builtin>
<userTransports>
<transport_id>TransportUDPv4</transport_id>
</userTransports>
<useBuiltinTransports>false</useBuiltinTransports>
</rtps>
</participant>
</profiles>