ADLINK-IST/opensplice

Communication problem between Python and C++

Closed this issue · 3 comments

Hello, I'm new to DDS. I implemented a topic finding program InteropDDS in python to try to communicate with HelloWorld example. findhello.py finds “HelloWorldData_Msg” topic and writes data to sub. When work with sacpp_helloworld_sub.exe, findhello does find the topic, but sacpp_helloworld_sub.exe cannot receive anything from findhello. And findhello works well with subhello.py, a sub program in python.
How to fix the communication problem? Is it related to domain ID? There is not any method to set ID in python api.

Opensplice community 6.9.181127OSS.

Dear Mr. Fire God,

There is no communication problem in your case. sacpp subscriber is not getting the data because of partition.
In your findhello.py, you are publishing data in default partition but in HelloWorldDataSubscriber the partition name is "HelloWorld Partition" . Subscriber can only get the data from the same partition (or follow the wildcard).
In DDS, Partitions provide a way of scoping information. This scoping mechanism can be used to organize topics into different coherent sets. You can get detailed information about partition from http://download.prismtech.com/docs/Vortex/html/ospl/DDSTutorial/topics-etc.html.

you can comment following lines of code in HelloWorldDataSubscriber.cpp to use default partition, your subscriber start getting the data.
.
sQos.partition.name.length(1);
sQos.partition.name[0] = "HelloWorld Partition";

With best regards,
Vivek Pandey
Solutions Architect
ADLINK Technology

It works, Thanks!
I have another question. The subhello.py can't receive data from HelloWorldDataSubscriber.cpp, nether commenting partition configuration in cpp nor setting same partition name with cpp in xml.

Dear Mr. Fire God,

There is no communication problem in your case. sacpp subscriber is not getting the data because of partition.
In your findhello.py, you are publishing data in default partition but in HelloWorldDataSubscriber the partition name is "HelloWorld Partition" . Subscriber can only get the data from the same partition (or follow the wildcard).
In DDS, Partitions provide a way of scoping information. This scoping mechanism can be used to organize topics into different coherent sets. You can get detailed information about partition from http://download.prismtech.com/docs/Vortex/html/ospl/DDSTutorial/topics-etc.html.

you can comment following lines of code in HelloWorldDataSubscriber.cpp to use default partition, your subscriber start getting the data.
.
sQos.partition.name.length(1);
sQos.partition.name[0] = "HelloWorld Partition";

With best regards,
Vivek Pandey
Solutions Architect
ADLINK Technology

Dear Fire God,
DDS uses a ‘request vs. offer’ QoS-matching approach, in which a data reader matches a data writer if and only if the QoS it is requesting for the given topic does not exceed (i.e. it is no more stringent than) the QoS with which the data is produced by the data writer. DDS subscriptions are matched against the topic type and name, as well as against the QoS being offered and requested by data writers and readers.

You can get details from below link:
http://download.prismtech.com/docs/Vortex/html/ospl/DDSTutorial/qos.html

For your problem, you need to make below changes :

  1. In your DDS_DefaultQoS_All.xml set.
    durability.kind = TRANSIENT_DURABILITY_QOS
    reliability.kind= RELIABLE_RELIABILITY_QOS

  2. Comment pQos.partition code in HelloWorldDataPublisher.cpp
    /* pQos.partition.name.length(1);
    pQos.partition.name[0] = "HelloWorld Partition"; /
    /
    Create the publisher. */

After above changes, Your subhello.py starts receiving data from HelloWorldDataPublisher.

With best regards,
Vivek