Flow of RTC development

(G)This section explains how to develop RT components using RT middleware (OpenRTM-aist).

Development flow

(G)OpenRTM-aist consists of a framework for componentization and middleware for managing and executing components.

(G)OpenRTM-aist provides a framework for easy RTC conversion of existing software assets owned by users (component developers) who wish to develop components, or newly created software. A rough flow of component creation is as follows.

RTC and RT system development flow

(G)As mentioned above, the code related to the common interface of the RT component, the processing of exchanging data with other components, etc. are hidden by the RT component framework. Since these processes are common, many parts can be created in libraries or automatically generated. OpenRTM-aist provides RTCBuilder as a tool for generating RTC templates.

(G)RTC developers build RT components by incorporating existing programs developed by themselves into the component framework and build robot systems by combining multiple RTCs. If existing software resources are created as RT components that are software components, reuse in various situations becomes easy. The created RTC can be placed in an appropriate place on the network and used from any place.

(G)RTC created according to the RTC framework can roughly be divided into two types. Standalone RTC (Standalone RT-Component) is a binary, loadable module RTC (Loadable Module RT-Component) of a single executable format is a dynamically loadable binary file, and it can process multiple types of RTC at the same time It is used for starting up etc.

Creating model code with RTC Builder

(G)RTCBuilder is a development tool that automatically generates template code of RT component. Most of the code is generated automatically by entering information on RTC's basic profile, data port, service port, and configuration. Supported languages are C ++, Java, Python, C #. Before creating the component, we decide the following things.

  • Profile (name, category name, version etc.)
  • Data port (InPort · OutPort, port name, data type)
  • Service port (port name, service interface)
  • Configuration (variable name, variable type)

(G)Select [File]> [New]> [Other] from the Eclipse menu to open the dialog, select "RTCBuilder" from "Others" and click "Next". Enter the project name and click [Finish]. The figure screen is displayed, RTCBuilder has tabs of "basic" "activity" "data port" "service port" "configuration" "document generation" "language / environment" "RTC.xml" tab. Finally, fill in the items as needed on the tab from "Basic" to "Language / Environment", finally select the project name entered earlier in the "Output Project" on the "Basic" tab, Click the Generate button to generate the template code. The generated code is saved in the folder of the project name in the workspace specified when Eclipse is started.

RTCBuilder development screen

Implementation of RTC

(G)Unlike ordinary programs, RT component programs do not directly implement processing in the main function. I will describe the implementation of the C ++ version as an example here.

(G)An RT component is implemented as a single class that inherits a base class. In the RT component, the processing performed by the logic is described by overriding the member function (method) of the base class. For example, the processing to be performed at the time of initialization is described in onExecute function in the onInitialize function, if you want the RTC to periodically process it when it is active.

 class MyComponent
  : public DataflowComponentBase
   // What we want to execute at initialization
   virtual ReturnCode_t onInitialize()
     if (mylogic.init())
       return RTC::RTC_OK;
     return RTC::RTC_ERROR;
   // Process to be executed periodically
   virtual ReturnCode_t onExecute(RTC::UniqueId ec_id)
     if (mylogic.do_someting())
       return RTC::RTC_OK;
   MyLogic mylogic;
   // Declaration of port etc.
   //   :

(G)The above is an implementation example in C ++. In this example, the class declaration and the implementation are united, but actually the code is generated by being divided into a header file (. H) and an implementation file (. Cpp). The object mylogic of the MyLogic class is a class that implements core logic that this component actually does. In the example, RTC is implemented by calling the mylogic function very simply, but even in the actual implementation, it is necessary to classify the core logic in such a manner that it can be easily used to this extent in advance, and the minimum number of calls in the RTC You better do.

(G)By compiling this code in a Makefile or a project file generated at the same time by RTC Builder, an executable file and a shared object (or DLL) are generated.

RTC life cycle

(G)As described above, in the implementation of RTC, components are created by describing processing in a predetermined function (callback function). In order to know what kind of function is called and at what timing it is called, it is necessary to understand the state transition of RTC, that is, life cycle. The figure below shows the RTC state transition diagram.

RTC Life Cycle (UML State Machine Diagram)

A component basically has the following state.

  • Creation state (Created)
  • Active state (Alive)
  • Inactive state (Inactive)
    • Active state (Active)
    • Error condition (Error)
  • Exit status

(G)At each of these states and transitions, a predetermined function (callback function) is called by the EC. The table shows the callback functions and the timing when each is called.

Function name Overview
onInitialize Called only once at the life cycle initialization.
onActivated Called once when activating.
onDeactivated Called once to deactivate.
onExecute Called periodically when in active state.
onStateUpdate Called after every onExecute.
onAborting Called once when shifting to the error state.
onError Called periodically when in error condition.
onReset Called once when returning from error condition.
onShutdown Called once when EC driving stops.
onStartup Called once when EC driving starts.
onFinalize Called only once at the end of the life cycle.

latest Releases

For Begginers

Windows msi(installer) package (only trying samples)

Development environment is required for RT-Component development. See download page for details.

Number of Projects


Dynamics simulator


Human-Robot-Interaction RTCs


Integrated Development Platform


Mobile Robot RTCs