Python binding for DDS

12 posts / 0 new
Last post
Offline
Last seen: 4 years 2 weeks ago
Joined: 10/28/2010
Posts: 22
Python binding for DDS

Hi Folks,

 

Is there any python binding  to use NDDS code inside python code.

 

Thanks

 

 

Keywords:
JavierPovedano's picture
Offline
Last seen: 7 months 2 weeks ago
Joined: 06/05/2013
Posts: 16

Hi Hakiri,

Although there RTI doesn't provide an official python binding for RTI Connext DDS, there are open-source bindings provided by the Community. An example of this is pyDDS, that also shows how to integrate Connext DDS with the Python Twisted framework. 

However, if the already available solutions you can use python ctypes to call C functions from RTI Connext libraries from Python.

 

burcu's picture
Offline
Last seen: 3 years 9 months ago
Joined: 08/27/2013
Posts: 5

Hi Hakiri,

Attached is a simple usage example that is based on pyDDS which can be found here: https://github.com/forrestv/pyDDS . To make it work, you have to follow these steps:

*  Create a data model with IDL and use rtiddsgen to generate code in C.

*  Using Visual Studio, make a few modifications to the files and configuration(explained below)

*  Create a DLL for the datatype

*  Create a python file, much like test.py, to easily create data and send or receive data and process.

I created the ShapeType.dll in Microsoft Visual C++ 2010 Express. C++ compiler mangles entry point names, so I had to generate the type support in C using rtiddsgen.

I created an empty project in Visual Studio and added all the generated “C” files in there. I had to export all the entry points so that c_types can call them. I had to do #define NDDS_USER_DLL_EXPORT in a header file that all other headers include.

 I also had to modify “Configuration Type” of the project from exe to dll.

 

To start publisher app:

$ python.exe test.py send

To start subscriber app:

$python.exe test.py recv

See the test.py for a publish and subscribe example application. I had to do simple modifications in dds.py like architecture and dll names(first 3 lines).

You can play with this example by incorporating our Shapes demo as well if you like(http://www.rti.com/downloads/index.html).

Please let me know if you have any questions.

 

Kind Regards,

Burcu Alaybeyi

File Attachments: 
Offline
Last seen: 8 months 2 days ago
Joined: 10/18/2013
Posts: 42

does RTI_Web_Integration_Service_1.0d work with Connext 5.1?

Offline
Last seen: 8 months 2 days ago
Joined: 10/18/2013
Posts: 42

also, is there a RHEL 6 version? 

rip
rip's picture
Offline
Last seen: 4 weeks 20 min ago
Joined: 04/06/2012
Posts: 315

The Web Integration Service you reference is an Engineering early access release (EAR), proof-of-concept.  It is based on a specific version of the RTI core DDS libraries (4.5 era). 

Additionally, the EAR coincided with the submission of the "Web Enabled DDS" specification, not its ratification -- so the WIS is based on the concept but not on the specification, itself. 

If you need further information about the status of the specification-based WIS implementation, please contact your local RTI sales team.

Regards,

rip

 

Offline
Last seen: 5 years 2 weeks ago
Joined: 07/01/2014
Posts: 6

Hello there 

Is there a python binding for DDS that does not use Ctypes or is in anyway a wrapper for C code.

Im looking for a way to use DDS directly with Python, the github files above I belive still use C/C++ code and act more as a python bridge between my python applications and DDS software, when im just looking for a direct implementation of DDS through Python.

 

burcu's picture
Offline
Last seen: 3 years 9 months ago
Joined: 08/27/2013
Posts: 5

Hi Ken,

Yes, pyDDS above is using ctypes that calls C eventually. We do not have native Python bindings for DDS yet. 

Please let us know if you have any other questions.

Thanks.

Burcu

Gerardo Pardo's picture
Offline
Last seen: 2 days 5 hours ago
Joined: 06/02/2010
Posts: 588

Hi Ken,

Can you explain a bit more the scenarios where having pyDDS load native libraries causes problems for you?  I thought dependance on native libraries was a common practice  in many Python libraries... 

Gerardo

Offline
Last seen: 5 years 2 weeks ago
Joined: 07/01/2014
Posts: 6

 

Let me change my question,  I want to run the test.py example , 

If I want to run this python binding on linux, I am having an issue with the .so file that is called by test.py. which generated files should I use to create the shared library that is called by test.py ? 

I just want to get a simple example running, so I have a Mytest.idl 

------------

struct MyTestStruct {

long Time;
};
-------------

I used rtiddsgen to get c code

$ rtiddsgen -language C -example x64Linux2.6gcc4.3.4 Mytest.idl 

then I went to the makefile created by the code generator and added "-fPIC" to the flag variables, afterwards I ran make

$ gmake -f makefile_Mytest_x64Linux2.6gcc4.3.4

then I made the .so file from the object files created by make ( Mytest.o MytestPlugin.o MytestSupport.o )

$ gcc -shared -o libMytest.so Mytest.o MytestPluggin.o MytestSupport.o 

I used the libMytest.so file created in the Test.py example but I get an undefined symbol error

$ OSError: ./libMytest.so: underfined symbol: DDSLog_g_submoduleMask

I would appreciate it if someone could give me some insight on this 

gianpiero's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 06/02/2010
Posts: 174

Hi Ken,

I am not familiar with pyDDS but it looks that is not finding a symbol.. do you have libnddscore and libnddsc into your LD_LIBRARY_PATH?

Let me know,
  Gianpiero

JavierPovedano's picture
Offline
Last seen: 7 months 2 weeks ago
Joined: 06/05/2013
Posts: 16

Hi Ken,

I was able to run your example. I attached a modified test to work in linux. Please note that my architecture is x64Linux3.xgcc4.6.3, so probably you will need changes to suit to your architecture

The only change you need to add is to load the nddsc and nddscore libraries (in dds.py) using the ctypes.RTLD_GLOBAL flags, so the dependencies needed by your library can be found. I also modified the test application to match your IDL definition

Let me know if you still face problems

Javier

File Attachments: