RTno V3

0. Abstract

RTno is communicating library and framework which allows you to make your embedded device capable of communicating with RT-middleware world.

RT-middleware is a platform software to realize Robotic system. In RTM, robots are developed by constructing robotics technologies\' elements (components) named RT-component. Therefore, the RTno helps you to create your own RT-component with your mbed and arduino.

To know how to use your RTno device, visit here: http://ysuga.net/robot_e/rtm_e/rtc_e/1065?lang=en To know about RT-middleware and RT-component, visit http://www.openrtm.org

1. Architecture

RTno is constructed with two parts: One is an embedded device (here, mbed). The other is a host PC's program.

RTno provides some APIs to communicate with PC's program. So, you do not have to customize your PC program.

Moreover, the PC's program takes a communication standard of OpenRTM-aist, so the PC program can communicate with other components.

Therefore, your embedded device can communicate with other OpenRTM-aist components. You only have to write code of your embedded device.

2. How to Program

2.1 Template

RTno for mbed provides RTnoV3_Template. You can modify this program's main.cpp like OpenRTM-aist.

http://mbed.org/users/ysuga/programs/RTnoV3_Template

2.2 Event Handler

onInitialized

Called when the device is started.

onActivated

Called when the component is activated by the system management software (ex., RT System Editor).

onDeactivated

Called when the component is deactivated.

onExecute

Called periodically when active.

2.3 DataPort APIs

DataPorts

You can use Data Ports to communicate with other devices. You can use OutPort and InPort classes.

DataType

DataTypes you can use with DataPorts are...

  • TimedBoolean, TimedBooleanSeq
  • TimedChar, TimedCharSeq
  • TimedOctet, TimedOctetSeq
  • TimedShort, TimedShortSeq
  • TimedLong, TimedLongSeq
  • TimedFloat, TimedFloatSeq
  • TimedDouble, TimedDoubleSeq

OutPort

If you use TimedLong with DataOutPort, write like...

TimedLong dataOutBuffer;
OutPort<TimedLong> dataOutPort("portName", dataOutBuffer);

InPort

If you use InPort with TimedDoubleSeq, write like...

TimedDoubleSeq dataInBuffer;
Inport<TimedDoubleSeq> dataInPort("portName", dataBuffer2);

Write to OutPort

To write outputting data...

dataOutBuffer.data = 1234;
dataOutPort.write();

If data is sequence...

dataOutBuffer.data.length( 3 );
dataOutBuffer.data[0] = 1;
dataOutBuffer.data[1] = 2;
dataOutBuffer.data[2] = 3;
dataOutPort.write();

Read From InPort

To check data is sent to InPort...

if ( dataInPort.isNew() ) {
  dataInPort.read();
  // write your code here
}

To read the data sent....

double data1 = dataInBuffer.data;

If data is sequence...

double data1 = dataInBuffer.data[0];
double data2 = dataInBuffer.data[1];
....

3. Examples

I also provide some examples for beginners!

1. LED control (digital out)

http://mbed.org/users/ysuga/programs/RTnoV3_LED

2. AD converter (Analog In)

http://mbed.org/users/ysuga/programs/RTnoV3_ADC

3. Timer (TimerExecutionContext)

http://mbed.org/users/ysuga/programs/RTnoV3_Timer

4. Ethernet (TCP)

http://mbed.org/users/ysuga/programs/RTnoV3_Ethernet

Please enjoy.

To comment, please visit My Web: http://www.ysuga.net/?lang=en About Me: http://about.me/ysuga Twitter: http://twitter.com/ysuga


Please log in to post comments.