Team leads know that allowing developers to use the programming languages they know drives productivity and results. And to keep productivity high, there is a clear need for broad compatibility when building today’s complex systems. These systems rightly require that any new technology must not only play well with legacy devices, but also work seamlessly in a world with multiple trusted and evolving programming languages, without requiring code rewrites or wrapper layers.
Python in particular is one of the fastest growing languages in the world, already ranked as the most popular programming language of 2020. So, what happens when the project demands the performance, extensibility and scalability of the Data Distribution Service™ (DDS) standard – and your team has dual skills with Python?
Fear not, loyal Python programmers – RTI can help you do it! All the benefits of DDS are within reach to help you stay in the zone and accelerate productivity. With a rich interface to RTI Connext® DDS Professional for Python, you can use the Connext DDS connectivity framework with a Python code base to easily communicate with smart machines and distributed systems.
Introducing RTI Python API for Connext DDS Professional
RTI Python API for Connext DDS Professional is the newest experimental offering from RTI Labs. It includes Python language libraries that extend Python applications with the rich feature set of Connext DDS Professional, enabling users to rapidly and dynamically develop code using Python. As RTI’s second entry into the Python world, it complements RTI’s Connector for Python. While Connector provides a quick and easy way to write Python applications that publish and subscribe to the RTI Connext DDS databus, the new Python API for Connext DDS Professional provides a more comprehensive API.
Frankly, there are some pretty compelling advantages. For example, you get a new feature set and RTI extensions in Python API that include1:
- The ability to create entities in code
- Quality of Service (QoS) configuration/mutability in code
- User accessible Listeners and WaitSets with support for all Condition types
- Standard content filtered topics and custom content filters, with the ability to modify filter parameters at runtime.
- Access to built-in DDS discovery topics
Python API Code Examples
One of the best features is that you can rapidly and dynamically develop code using Python’s REPL. For example, you can do something like this:
Figure 1
This sample code above shows a simple example of how you can use the REPL.
We also are able to leverage Python types. For example, you can populate a Dynamic Data sample from a Python dictionary. This can be done as follows:
Figure 2
The API currently supports Dynamic Data and the OMG standard built-in types for user topics. Dynamic Data provides the flexibility to support a wide range of user data types and can take advantage of Python’s runtime reflection.
We’re also really happy to say that this library takes advantage of Pythonic features!
Figure 3
Here’s an example of using the “iter” function implicitly with a for loop. You also get the ability to declare two variables at once from a tuple, something very useful for this common pattern of taking values from a reader. You can iterate naturally through structures and collections, convert objects to strings using the “str” function, and much more. These magic functions give us a lot of power and the ability to write concise code.
One of its more productive new features is a nice scripting interface. If you want to monitor your applications or analyze data in a way that is not possible with current tools, you can rapidly write Python scripts to interact with the databus. Python is highly flexible and we’re very excited to see how people use this API in their projects!
The API works on Linux, macOS, and Windows and can be used with Python 3.x or Python 2.7. Building is straightforward and only requires a few dependencies. Documentation is provided and API references can also be accessed at runtime or from the shell. Just call the “help” function in Python and it will return the documentation string for the specified method or object.
Conclusion
Even in its current prototype iteration, the Python API can already help streamline a wide variety of crucial programming tasks. For example, does your application require thread safety? Do you need to load RTI plugins such as Monitoring or DDS Secure? Do you want to be able to modify QoS at runtime (e.g. ownership strength)? Do you want to access read/query/guard conditions? Do you want to access DDS discovery traffic (built-in subscribers)? Do you want to perform a topic query? Do you want to dynamically create or delete DDS entities? If the answer to any of these questions is a yes, then you’ll certainly want to check out our new Python API.
Author note: Special thanks to Alex Campos, Hunter Barbella and Thejas Kesari for their work on the API!
1Note: This is an experimental product and the API is subject to change.
October 11, 2023 Note: In response to developers’ demand for rapid development and testing in the language of choice, Connext 7.2 now fully supports Python, alongside C, C++, Java, and C#. With the addition of pip-based installation and support for Request-Reply, the Connext Python API has shed its experimental status and become a fully-supported language API for production systems. This means users can develop and test mission-critical systems faster and more conveniently, using the preferred programming language they’re familiar with.
About the author
Marc Chiesa is a Senior Application Engineer on the Professional Services team at RTI. Prior to joining RTI in 2017, he worked in the defense industry for 17 years. Marc holds a BS in Electrical Engineering from Stanford University and an MS in Computer Science from Johns Hopkins University.
Posts by Tag
- Developers/Engineer (174)
- Connext DDS Suite (77)
- Technology (74)
- News & Events (71)
- 2020 (54)
- Standards & Consortia (51)
- Aerospace & Defense (47)
- 2023 (35)
- Automotive (34)
- 2022 (29)
- IIoT (27)
- Leadership (24)
- 2024 (22)
- Cybersecurity (20)
- Healthcare (20)
- 2021 (19)
- Military Avionics (15)
- Culture & Careers (14)
- FACE (13)
- Connectivity Technology (11)
- Connext DDS Pro (10)
- JADC2 (10)
- ROS 2 (10)
- Connext DDS Tools (7)
- Connext DDS Micro (6)
- Databus (6)
- Transportation (5)
- Case + Code (4)
- Connext DDS (4)
- Connext DDS Cert (4)
- Energy Systems (4)
- FACE Technical Standard (4)
- Oil & Gas (3)
- RTI Labs (3)
- Research (3)
- Robotics (3)
- #A&D (2)
- Connext Conference (2)
- Edge Computing (2)
- MDO (2)
- MS&T (2)
- TSN (2)
- ABMS (1)
- C4ISR (1)
- ISO 26262 (1)
- L3Harris (1)
- LabView (1)
- MathWorks (1)
- National Instruments (1)
- Simulation (1)
- Tech Talks (1)
- UAM (1)
- Videos (1)
- eVTOL (1)