File: README.md

package info (click to toggle)
fastdds 3.1.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 58,132 kB
  • sloc: cpp: 779,516; xml: 15,119; python: 4,356; sh: 190; makefile: 93; ansic: 12
file content (99 lines) | stat: -rw-r--r-- 4,473 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Static EDP discovery example

The *eProsima Fast DDS static EDP discovery* example is an application intended to be a DDS deployment configured with a static EDP discovery phase.

This example is part of the suite of examples designed by eProsima that aims to illustrate the features and possible configurations of DDS deployments through *eProsima Fast DDS*.

In this case, the *static EDP discovery* example allows configuring the EDP phase to use a XML file with information about the remote endpoints aimed to match with, that is use in the PDP phase.
Please refer to the [Static Discovery](https://fast-dds.docs.eprosima.com/en/latest/fastdds/discovery/static.html#static-discovery-settings) section in the *eProsima Fast DDS* documentation for more information.


* [Description of the example](#description-of-the-example)
* [Run the example](#run-the-example)

## Description of the example

Each example application (publisher and subscriber) creates the required DDS entities per case.
Each application inherits from the corresponding listener(s) class(es), overriding the listener's method associated to each event.
When an event occurs, the callback method is triggered.

Moreover, this example uses loans API in both reading and writing calls (refer to ``on_data_available()`` and ``publish()`` methods, respectively)

The discovery phase can be performed through different mechanisms as simple (default), manual, static and discovery server.
This example aims to display the deployment of a static discovery mechanism, which is setup in the participant configuration to avoid all EDP meta-traffic.
It can only be configured when all the datareaders and datawriters (the endpoints part of the EDP discovery phase) are known beforehand.
The ``HelloWorld_static_disc.xml`` file contains the endpoints information that has been configured in the publisher and the subscriber applications, such as Durability and Reliability QoS, user ID, and endpoint ID.

All the example available arguments can be queried running the executable with the **``-h``** or **``--help``** argument.

## Run the example

To launch this example, two different terminals are required. One of them will run the publisher example application, and the other will run the subscriber application.

### Static EDP discovery publisher

* Ubuntu ( / MacOS )

    ```shell
    user@machine:example_path$ ./static_edp_discovery publisher
    Publisher running. Please press Ctrl+C to stop the Publisher at any time.
    ```

* Windows

    ```powershell
    example_path> static_edp_discovery.exe publisher
    Publisher running. Please press Ctrl+C to stop the Publisher at any time.
    ```

### Static EDP discovery subscriber

* Ubuntu ( / MacOS )

    ```shell
    user@machine:example_path$ ./static_edp_discovery subscriber
    Subscriber running. Please press Ctrl+C to stop the Subscriber at any time.
    ```

* Windows

    ```powershell
    example_path> static_edp_discovery.exe subscriber
    Subscriber running. Please press Ctrl+C to stop the Subscriber at any time.
    ```

## Expected output

Regardless of which application is run first, since the publisher will not start sending data until a subscriber is discovered, the expected output both for publishers and subscribers is a first displayed message acknowledging the match, followed by the amount of samples sent or received until Ctrl+C is pressed.

### Static EDP discovery publisher

```shell
Publisher running. Please press Ctrl+C to stop the Publisher at any time.
Publisher matched.
Message: 'Hello world' with index: '1' SENT
Message: 'Hello world' with index: '2' SENT
Message: 'Hello world' with index: '3' SENT
...
```

### Static EDP discovery subscriber

```shell
Subscriber running. Please press Ctrl+C to stop the Subscriber at any time.
Subscriber matched.
Message: 'Hello world' with index: '1' RECEIVED
Message: 'Hello world' with index: '2' RECEIVED
Message: 'Hello world' with index: '3' RECEIVED
...
```

When Ctrl+C is pressed to stop one of the applications, the other one will show the unmatched status, displaying an informative message, and it will stop sending / receiving samples. The following is a possible output of the publisher application when stopping the subscriber app.

```shell
Message: 'Hello world' with index: '8' SENT
Message: 'Hello world' with index: '9' SENT
Message: 'Hello world' with index: '10' SENT
Message: 'Hello world' with index: '11' SENT
Publisher unmatched.
```