DDSRTI communication between C++ and python

7 posts / 0 new
Last post
Offline
Last seen: 5 years 11 months ago
Joined: 04/18/2018
Posts: 2
DDSRTI communication between C++ and python

Hi,

I have downloaded "rticonnextdds_connector-0.2.1" and tried a sample(ShapeExample) for C++ and Python. I was able to communicate within C++ process by "running ./objs/x64Linux2.6gcc4.4.5/ShapeExample_publisher" and "./objs/x64Linux2.6gcc4.4.5/ShapeExample_subscriber" in 2 terminals.

Similarly I was able to communicate between Python process by running "reader.py" and "writer.py" in 2 terminals. (Python import and uses "rticonnextdds_connector-0.2.1/lib/x64Linux2.6gcc4.4.5/librti_dds_connector.so").

Now I have C++ application and it want to communicate to Python using DDSRTI.

For eample run "./objs/x64Linux2.6gcc4.4.5/ShapeExample_publisher" in one terminal and "reader.py" in another terminal. But  this seems not working, I understand C++ uses ""ndds/ndds_c.h"" header and python uses ctypes wrapper which is provided by "librti_dds_connector.so". Is there a way we can achive this communication ?

Note: 

gianpiero's picture
Offline
Last seen: 3 months 2 days ago
Joined: 06/02/2010
Posts: 177

Hello,

I generated a C++ example using rtiddsgen. Then i used the simple/reader shipped with the python connecton and i modified to use your xml file. 

First thing i noticed is that the generated example is publishing on topic Example ShapeType and the xml file used for python is subscribing on topic Square

I fixed that in the C++ publisher by using Square in the create_topic call. Recompiled, run again --> No comunication. 

I used RTI Admin Console to see what was the problem. RTI Admin Console reported a mismatche type. The Shape type you are using in IDL is different than the one that is used in the XML. 

I run rtiddsged -convertToXML shapeexample.idl . This generated shapeexample.xml that i used to cut and past the ShapeType definition in the XML file you attached. 

The two processes can now talk to each other. 

Please let me know if this solves your issue

Best,

  Gianpiero

 

 

Offline
Last seen: 5 years 11 months ago
Joined: 04/18/2018
Posts: 2

Hi Gianpiero,

Wow thanks for the fix, it worked well !!!

Can you help with when will the rticonnextdds_connector(rticonnextdds_connector-0.2.1.tar) for python be officially released.

Thanks,

Jayasanker

 

 

 

 

 

gianpiero's picture
Offline
Last seen: 3 months 2 days ago
Joined: 06/02/2010
Posts: 177

Hi Jayasanker,

I am glad I could help!!!

Connector is now an experimental feature. If you want to know more about productization plans I'd suggest you contact yout local sales representative or write to support@rti.com

Best,
  Gianpiero

 

Offline
Last seen: 4 years 6 months ago
Joined: 06/21/2018
Posts: 5

Hi Gianpiero,

         Is the DDSRTI connector support communication between C/C++ and Java?

Thanks,
Jon

 

sara's picture
Offline
Last seen: 1 year 4 months ago
Joined: 01/16/2013
Posts: 128

Hi Jon-Wu,

RTI Connector is designed to be used with scripting languages. We do have native DDS APIs for C, C++, C++11, and Java. Why would you prefer to use Connector instead of a native API? Is there any feature from Connector you cannot find in the other APIs?

Thanks,
sara

Offline
Last seen: 4 years 6 months ago
Joined: 06/21/2018
Posts: 5

Hi Sara, 

      Thanks for the response.  I am trying to figure out how to communicate two seperate DDS applications: One is running as a Server using C/C++ code and the other one is running as a Client using Java code. Is native API on DDS would work? If so, could you point me to the documentations or examples of how Server/Client written with different languages can communicate? 

Thanks,

Jon