We will check if various forms of msg with different typename and fields can be communicated across pub sub nodes. Msgs are shown below:
- Message:
HelloWorld_v1.idl
Type 1 | Type 2 | Type 3 |
struct HelloWorld_v1
{
unsigned long index;
string message;
}; |
struct HelloWorld_v1
{
unsigned long index;
string message;
float value;
}; |
struct HelloWorld_v1
{
short index;
string message;
}; |
- Message
HelloWorld_v2.idl
(type4 with extensibility)
Type 1 | Type 2 | Type 3 | Type 4 |
struct HelloWorld_v2
{
unsigned long index;
string message;
}; |
struct HelloWorld_v2
{
unsigned long index;
string message;
float value;
}; |
struct HelloWorld_v2
{
short index;
string message;
}; |
@appendable
struct HelloWorld_v2
{
unsigned long index;
string message;
float value;
}; |
- Message
HelloWorld_v3.idl
Type 1 | Type 2 | Type 3 |
@appendable
struct HelloWorld_v3
{
unsigned long index;
string message;
float value;
sequence<double> data;
}; |
@appendable
struct HelloWorld_v3
{
unsigned long index;
string message;
short value;
}; |
@appendable
struct HelloWorld_v3
{
unsigned long index;
float message;
short value;
}; |
Fast DDS | Cyclone DDS | RTI Connext | |
---|---|---|---|
Same Type Name: HelloWorld_v1.idl with HelloWorld_v1.idl |
|||
V1T1 with V1T2 |
✓ | ✗ | ✓ |
V1T1 with V1T3 |
✓ | ✗ | ✗ |
V1T2 with V1T3 |
✓ | ✗ | ✗ |
Mismatch Type Name HelloWorld_v1.idl with HelloWorld_v2.idl |
|||
V1T1 with V2T1 |
✗ | ✗ | ✓ |
V1T1 with V2T2 |
✗ | ✗ | ✓ |
V1T1 with V2T3 |
✗ | ✗ | ✗ |
V1T1 with V2T4 |
✗ | ✗ | ✓ |
Extensibility with mismatch type name HelloWorld_v2.idl with HelloWorld_v3.idl |
|||
V2T4 with V3T1 |
✗ | ✓ | ✓ |
V2T4 with V3T2 |
✗ | ✗ | ✓ |
V2T4 with V3T3 |
✗ | ✗ | ✗ |
-fastdds
is tested with fastdds/HelloWorldExample/
-cyclonedds
is tested with cyclonedds/helloworld/
-rticonnext
is tested with rticonnext/hello_world_example/c++11/
Refered to eproxima official doc
mkdir fastdds_ws
cd fastdds_ws
wget https://raw.githubusercontent.com/eProsima/Fast-DDS/master/fastrtps.repos
mkdir src
vcs import src < fastrtps.repos
Refered to this from eproxima
cd /fastdds_ws
source install/setup.bash
cd src/dds_experimentation/fastdds/DynamicHelloWorldExample
mkdir build
cmake ..
make -j4
Run pub sub in 2 different terminals
# In the first one launch:
./DDSDynamicHelloWorldExample publisher
# In the second one:
./DDSDynamicHelloWorldExample subscriber
The msg definition is defined in the example_type.xml
. The example shows the publisher publishes CustomMsgFoo
and CustomMsgBar
msg types. And the sub will only able to sub to one type during discovery. Note that the msg definition is parsed via dds from the pub to sub participant.
Uses fastddsgen
Quick installation, follow: https://fast-dds.docs.eprosima.com/en/latest/installation/sources/sources_linux.html#fast-dds-gen-installation
After installations and compilations, generate headers
cd dds_experimentation/fastdds/HelloWorldExample
java -jar ~/fastdds_ws/src/fastddsgen/share/fastddsgen/java/fastddsgen.jar HelloWorld_v1.idl -replace
mkdir build && cd build
cmake .. && make -j4
# run
./DDSHelloWorldExample publisher
./DDSHelloWorldExample subscriber
Modified the HelloWorldExample script (~/Fast-DDS/examples/C++/DDS/HelloWorldExample/build
), and let the publisher publishes an incompatible topic.
Provide listener class member to create_topic()
function. However, currently the TopicListener::on_inconsistent_topic()
callback is not working as it isn't yet being implemented (refer here).
Working in progress in HellowWorldExample
Install RTI:
Download and install, 6.X.X: https://www.rti.com/free-trial/dds-files.
Select the provided rti license during installation via the RTI Launcher
gui
export NDDSHOME=~/rti_connext_dds-6.1.1
export PATH=${PATH}:~/rti_connext_dds-6.1.1/lib/x64Linux4gcc7.3.0
Then compile in build
dir
cmake ..
make -j4
A modified example code of listeners
After compile with cmake (cd builld && cmake .. && cmake --build .
), then run:
./listeners_subscriber
./listeners_publisher
publisher temp creates an incompatible topic, which will trigger subscriber to call on_inconsistent_topic
.
Printout from subscriber, notice the on_inconsistent_topic
callback
youliang@youliang-XPS-13-7390:~/rticonnextdds-examples/examples/connext_dds/listeners/c++11/build$ ./listeners_subscriber
RTI Connext DDS EVAL License issued to open robotics [email protected] For non-production use only.
Expires on 01-Jul-2022 See www.rti.com for more information.
ParticipantListener: on_inconsistent_topic()!!!
msg def::topic_listeners listeners
ReaderListener: on_subscription_matched()
ReaderListener: on_liveliness_changed()
Alive writers: 1
SubscriberListener: on_data_on_readers()
[x: 1]
SubscriberListener: on_data_on_readers()
[x: 2]
Originated from here. During build, the connextdds_add_example.cmake
will generate cpp headers according to .idl
.
cd hello_world_example
mkdir build cd build
cmake ..
make -j4
Run pub sub
./example_publisher
./example_subscriber
Install with colcon, refer to this
Testout modified helloworld code, with on_inconsistent_topic
callback of cyclonedds C api, defined here
source ~/cyclonedds_ws/install/setup.bash
mkdir build
cmake ..
make -j4
Run
./HelloworldPublisher
./HelloworldSubscriber
Unfortunately, not able to trigger on_inconsistent_topic
callback
The above example also shows the usage of dds's extensibility by using @appendable
in 2 different .idl definitions for pub sub.
To switch sub with msg v2, set #define MSG_VERSION 2
in subscriber.c