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

2 min read

Dynamically Scriptable Distributed Components in Lua using DDS

Dynamically Scriptable Distributed Components in Lua using DDS

At the RTI Labs we are excited about the Internet of Things (IoT).

We have been working on a new component model that makes it really easy to construct sophisticated distributed systems without needing to compile or generate a single line of code. Furthermore, the code can be changed on the fly, without having to restart components. The global state of a component is preserved between executions while its code can change, thus allowing for component behavior to change dynamically. The wiring of the components is specified in a separate configuration file. A container loads the configuration file, binds the communication resources to the logical I/O ports on the component, and runs the component code.

The component code is written in a scripting language called Lua. Lua is popular in the gaming community, and has recently been adopted by the Eclipse Machine-to-Machine (M2M) community. We chose Lua because it is easy to embed and extend in C, has a very small footprint, does not necessarily require an OS and is considered by some to be the fastest scripting language. Like JavaScript and Python, popular in web and DevOps communities, it is a dynamically typed language that is easy to learn, and brings the same benefits of agile and rapid development. Lua is mature and well thought out. It has been around longer than Java and JavaScript, and is simply fun to program in!

For example, a transformation of the data used in the RTI Shapes Demo application can simply be written in Lua as:

Shapes Demo in Lua

The above code takes input shapes from the data-space, changes their size, and writes them back to the data-space. We run this in a container that wires the input to the Square topic and output to the Triangle topic in the data-space used by the Shapes Demo. We can see the shape mediation happening in real-time:

shape-mediation.png

Now, if we increase the SIZE_FACTOR from 0.5 to 5 in a text editor, we immediately see the updated output:

shape-mediation-updated.png
(Click to view full-size image)

We have built the component model to run in a variety of containers. We are publicly releasing an experimental container using the XML-Based application configuration and prototyping capability for defining the data types, QoS, and DDS endpoints. The container can be configured to run the component code upon any or all of the following events: startup, shutdown, data arrival or a periodic timer.

The result is a deeply data-centric architecture that decouples data from the code not just at the system level (using DDS) but also at the component level. The application architecture is easy to maintain and evolve for both large and small teams. It clearly separates the role of the component/algorithm developer responsible for business logic from the system integrator responsible for wiring the components and configuring quality of service (QoS) at the system level.

This new experimental component technology is available as a free download from the RTI Community Portal. Included in the bundle is a detailed getting started guide and several working examples showing correlation, splitting, aggregation, transformation, choreography, device I/O, data collection and data generation.

Give it a whirl — Go ahead and use it to build your next IoT app and let us know what you think!

NOTE: We are presenting at the OMG Component Workshop in Berlin today, June 17.