Skip to the main content.

Did you know?

 

RTI is the world’s largest DDS supplier and Connext is the most trusted software framework for critical systems.

Success-Plan-Services-DSSuccess-Plan Services

Our Professional Services and Customer Success teams bring extensive experience to train, problem-solve, mentor, and accelerate customer success.

Learn more

Developers

From downloads to Hello World, we've got you covered. Find all of the tutorials, documentation, peer conversations and inspiration you need to get started using Connext today.

Try the Connectivity Selection Tool ⇢

Resources

RTI provides a broad range of technical and high-level resources designed to assist in understanding industry applications, the RTI Connext product line and its underlying data-centric technology.

Company

RTI is the infrastructure software company for smart-world systems. The company’s RTI Connext product is the world's leading software framework for intelligent distributed systems.

Contact Us

News & Events
Cooperation

3 min read

Staying in the Zone: Introducing the RTI Python API

Staying in the Zone: Introducing the RTI Python API

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

IMG_3983Marc 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.