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.
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).
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.
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.
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...
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 )
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
RTI provides a Python API that provides access to most Connext features from Python. As of version 7.3.0 of Connext, It is supported on Python 3.6 to 3.12, and on Linux x64 and arm64, Windows x64, and macOS x64 and arm64.
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.
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
does RTI_Web_Integration_Service_1.0d work with Connext 5.1?
also, is there a RHEL 6 version?
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
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.
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
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
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
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
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
Hi Hakiri,
RTI provides a Python API that provides access to most Connext features from Python. As of version 7.3.0 of Connext, It is supported on Python 3.6 to 3.12, and on Linux x64 and arm64, Windows x64, and macOS x64 and arm64.
If you want to learn more about it, you can follow the Python version of the Connext Getting Started Guide, or take a look at the API overview and reference documentation.
It is worth noting that besides being part of the host installation of RTI Connext Professional, the Python API can be installed from PyPI using pip.
Best regards,
Fernando