RT-Component development

RT-Component FAQ.

Naming rules for RT-Component instances

The default rule used to name RT-Component isntances is:

 [RT-Component type name] + [index (0,1,2,3,...)]

The type name is specified in the component profile (usually specified in the component's source file). The index is used for components instantiated using the same type in the same manager.

If components are instantiated using the same type but separate managers, they may use the same instance name on the name server. The most recent component that registers will overwrite any previous registrations. You can avoid this by:
  • Start the components in the same process.
  • Specify a name format that doesn't collide by editing naming.formats in the rtc.conf files.

How can I use non-standard data types for InPort or OutPort

Usually, in OpenRTM-aist, you can use a large number of data types defined in IDL files supplied with OpenRTM-aist, such as TimedShort, TimedDoubleSeq and RangeData.

When you want to define and use data types other than these for your InPorts and OutPorts, you need to define them in your own IDL, and compile and link that when you compile the components.

Let's assume we want use a data type to store images, which has size (width, height), depth, and image data as members (note that OpenRTM-aist supplies a CameraImage data type). Define the following data type in your IDL:

 #include <rtm/idl/DataType.idl>
 struct TimedImage
 {
   Time tm;
   long width;
   long height;
   long depth;
   sequence<octet> data;
 };

The Time type is a type for timestamps that is defined in OpenRTM-aist. You may not need to include it but it is typically a good idea. Save this to a file named TimedImage.idl. Put this file in the directory where the component source is located. Next, generate the component with rtc-template. At that time, specify this IDL file to --consumer-idl option.

 rtc-template -bcxx    --module-name=ConsoleIn --module-type='DataFlowComponent'    --module-desc='Console input component'    --module-version=1.0 --module-vendor='Noriaki Ando, AIST'    --module-category=example    --module-comp-type=DataFlowComponent --module-act-type=SPORADIC    --module-max-inst=10 --outport=out:TimedImage    --consumer-idl=TimedImage.idl

In this example, we use the TimedImage type defined in TimedImage.idl as the data type of OutPort. Let's compile the generated code.

 make -f Makefile.ConsoleIn

As a result, TimedImage.idl is compiled by the IDL compiler and linked to the component. Usage of data in the component is the same as usual.

If you want use the same data type as this one in another component, please copy this IDL file and specify the file to consumer-idl option of rtc-template in a similar way.

Now you can connect components using this data type.

Check the following points when it doesn't work.

1. Is TimedImage.idl correct?

 #include <BasicDataType.idl>
 module RTC
 {
   struct TimedImage
   {
     Time tm;
     long width;
     long height;
     long depth;
     sequence<octet> data;
   };
 };

2. Is there an entry related to the stub in the Makefile?

 ...
 STUB_OBJ = TimedImageStub.o
 ...
 TimedImageStub.cpp : TimedImage.idl
        $(IDLC) $(IDLFLAGS) -I/usr/include/rtm/idl TimedImage.idl
        $(WRAPPER) $(WRAPPER_FLAGS) --idl-file=TimedImage.idl
 TimedImageStub.h : iis.idl
        $(IDLC) $(IDLFLAGS) -I/usr/include/rtm/idl TimedImage.idl
        $(WRAPPER) $(WRAPPER_FLAGS) --idl-file=TimedImage.idl
 ...

 foo.so: $(OBJS)
 foo.o: foo.h TimedImageStub.h             
 fooComp.o: fooComp.cpp foo.cpp foo.h TimedImageStub.h

 TimedImageStub.o: TimedImageStub.cpp TimedImageStub.h

3. Is the stub.h included by foo.h? Is the type declared?

 ...
 #include "TimedImageStub.h"
 ...
 TimedImage m_hoge;
 InPort<TimedImage> m_hogeIn;

Sending more than 2MB via data ports

When data that exceeds 2MB is sent through data ports, it is necessary to specify this. In omniORB, the size that can be treated with the GIOP (General Inter-ORB Protocol) s 2097152B (2MB) by default. When data that exceeds this size is sent, the correct data cannot be sent because of the GIOP limitation. The maximum size can be changed:

Specify the maximum size in rtc.conf

 # file: rtc.conf
 corba.nameservers: localhost
 naming.formats: %n.rtc
 corba.args: -ORBgiopMaxMsgSize 3145728 # add
                                        # The maximum size was changed to 3MB.

Specify the maximum size in an environment variable

  export ORBgiopMaxMsgSize=3145728

When giopMaxMsgSize is specified, it is necessary to set it on both the server and client (paired components).
(omniORB configuration and API) http://omniorb.sourceforge.net/omni41/omniORB/omniORB004.html

A new Java project cannot be made with JDK6 (1.6)

JDK might not be able to be selected by the following dialogs being displayed when trying to make a new Java project.

new_project_name_ja.png
Dialog of new Java project in which selection of JDK is not displayed

In RTCBuilder project, it is necessary to specify JDK for the value of JRE of this dialog (Java execution environment). Enable the selection of JDK in the following way. Click the "JRE is composed" link in the JRE intraframe as shown in the above figure.

new_JRE_setting_ja.png
Installed JREs

Push the "Addition" button.

new_JRE_VM_setting_ja.png
Selecting the type of JRE

Select the standard VM and click Next. The dialog for adding a JRE is displayed.

add_JRE_ja.png
Adding a JRE

Click the "Directory" button, and select the path to JDK6. (Typically, C:\Program Files\Java\jdk1.6.0_XX)

select_JDK_ja.png
Setting the path to JDK6

The following dialog will be displayed if the path is correct.

load_JDK_ja.png
Path for JDK

Return to the "Installed JRE" dialog (with JDK added), and change the value of the JRE assumed to be active as shown in the figure below to JDK, and click the "OK" button.

set_active_JDK_ja.png
Change the check to JDK.

SelectJDKasJRE_ja.png
Specify JRE in JDK

Building a project that exists in an arbitrary folder with Ant

This explains how to set a new class path not set in RTM_JAVA_ROOT.

Open the Ant settings dialog in Eclipse.

Right-click on build_<CompName>.xml in the Package Explorer, and select "Execution">"Ant build".

Call_Ant_Setting_ja.png
Opening the Ant settings dialog.

Set the class path.

Select the class path tab.

Ant_Setting_Classpath_ja.png
Selecting the class path tab.

Select "User entry" and click "External JAR addition."

Ant_External_Jar_ja.png
Adding an external JAR

Specify the path of the target JAR library in the dialog. It will appear in the Ant settings dialog.

Ant_Add_Jar_ja.png
Added JAR

Important note

It is necessary to set RTM_JAVA_ROOT (however, there is no problem even if a dummy value is set). Please do not delete the RTM_JAVA_ROOT variable when it is not needed. An error occurs in the build when RTM_JAVA_ROOT is not set. Moreover, RTM_JAVA_ROOT should indicate the directory of the name of "jar".

Download

latest Releases : 2.0.0-RELESE

2.0.0-RELESE Download page

Number of Projects

Choreonoid

Motion editor/Dynamics simulator

OpenHRP3

Dynamics simulator

OpenRTP

Integrated Development Platform

AIST RTC collection

RT-Components collection by AIST

TORK

Tokyo Opensource Robotics Association

DAQ-Middleware

Middleware for DAQ (Data Aquisition) by KEK