RTC-scilab


RTC-scilab is a scilab toolbox which interconnects between “RT-middleware” and “scilab/xcos.”
This toolbox help robotics developers to model/simulate/prototype their own robots!

!! This software won the RT-middleware contest 2010 !!
RT-middleware Contest Web

!! This software got the second prize in the Scilab Toolbox Contest Japan 2010 !!
Scilab Toolbox Contest Japan Web

Abstract
RTC-scilab is a toolbox which helps to develop your own RTCs by using scilab and xcos. As you know, scilab and xcos are very appropriate for modeling dynamical process and controller, so the RTC-scilab will be suitable tool to install your imagination to your robot!

What is RT-middleware?

RTC-scilab Logo

Recently, Robotics Technologies (RT) are widely expected to contribute to our lives in many application areas, such as helthcare, nursing, hard-working, and so on. However, most of companies and laboratories are still continuing to build their robots in their own platform. RT-middleware is a common platform which will increase the re-usability of your robotics technologies.

In RT-middleware, the robotics technologies’ elements, like actuators and sensors, are regarded as independent software components named “RT-component (RTC)”, and in the RT-middelware world, developers build their robots by connecting some RTCs. The RTCs encapsulate the robotics elements’ own APIs, so the developers can skip to read horribly thick manuals!

Actually, RT-middleware is just a standard, not implementation. An implementation is provided by National Institute of Advanced Industrial Science and Technologies (AIST). It’s OpenRTM-aist. OpenRTM-aist is currently the best available implementation of RT-middleware standard, so in this website, the word, RT-middleware, is equal to OpenRTM-aist.

If you want to know more information, please visit openrtm.org

Concept of RTC-scilab

RTC-scilab enables developers to build their own RTCs by using scilab that is very high efficiency of code productivity.

If you want to know about scilab in more detail, please visit scilab.org

Suppose you are developing your own robot now.

You buy a lot of actuators and sensors. If those robotic elements’ software are available for OpenRTM-aist, you can start to use them soon.

However, it is indispensable for you to develop your main control logic (or rules) as (an) RTC(s).

RT-middleware has already released some graphical tools to help RTC developers. Those tools are capable of automatically generating skeleton-codes which include a lot of comments. But I thought that the intuitive tools which directly connect “implementation” and “theory” are needed. RTC-scilab is the tool!

What is RTC-scilab

scilab is a numerial calculation platform software, like MATLAB. scilab is lightweight software and it’s completely free and open, so you can install scilab in your own computers! scilab includes “xcos” which is a graphical tool which supports dynamical and discrete (hybrid) simulation, so it is quite suitable for mathematical simulation, model-based-engineering, and education.

RTC-scilab interconnects the scilab and the RT-middleware, so the mathematical representation can be intuitively implemented into your robot! You can test your algorithm easily using your own robotics platform!! And it’s open and free!

The RTC-scilab is provided under GPL.

Concept of RTC-scilab

Functions of RTC-scilab

RTC programming by using scilab language

The RTC developmental efficiency is dramatically improved by using a variety of technological calculation tools in “scilab”, such as the data-visualization, the matrix calculation, the numerical analysis, etc.

The Scilab language is appropriate for the numerical computation, and a lot of developers all over the world are offering the library for free.

The RTC-scilab offers a function of data-exchange between scilab space and RTC space. It enables you to send the result of numerical computation to the actuators.
scilab can also receive datas directly from the RTCs of sensors.

Scilab programming

RTC development with “xcos”

Xcos is a graphical tool for modeling dynamical/discrete system.
Using Xcos, developers can sketch the controlling system as if to draw a block diagram. So it provides very intuitive development environment.

RTC-scilab provides OutPort/InPort blocks which output/input datas from the RTCs dataport.

RTC-scilab with Xcos

Synchronization with OpenHRP3

OpenHRP3 is a dynamical simulator for robots.

RTC-scilab provides synchronization mechanism with OpenHRP3, so that you can simulate your own dynamical controller with the robot model in OpenHRP3 simulator.

Connecting OpenHRP3

Install

OpenRTM-aist

Windows Version

Download OpenRTM-aist 1.0Release from official web site.
We will use Visual C++ 2008. Free Express Edition can be used.

Linux version

You can install linux version of OpenRTM. Please refer official website

scilab

Windows version

Currently, I have checked scilab 5.2.2. You can download the scilab in the official website. You must use 32 bit version.

Linux version

You can install scilab from apt-get command like “sudo apt-get install scilab”.

Installing RTC-scilab

1. Build

1.Download sources. If you get the zip archive, please extract the source codes in your favorite directory;-)
2.Execute scilab in following process:
a. In Windows, double click “builder.sce”, or launch scilab from start menu. If you launch scilab from start menu, please change current directory to the RTC-scilab’s source code directory (rtc_scilabXXX folder).
b. In Linux, change directory to the RTC-scilab’s source code directory, and type “scilab”.
/// tips
cd … change directory.
pwd … print current directory
3. Then, execute builder.sce. Just type “exec builder.sce”. If this command fails, you are not in the RTC-scilab’s source code directory.
4. Please wait.

If you had any problems, please let me know. Don’t hesitate to inform me your problem. It will make me very happy.

2.Setup RTC-scilab

Please place the build RTC-scilab package in the scilab/contrib folder.
In windows, usually “C:/Program Files/scilab5.2.2/contrib/”
In Linux, “/usr/local/scilab5.2.2/share/scilab/contrib” in my environment.

Download

Newest code

http://github.com/ysuga/RTC-scilab

Archive

rtc_scilab081.zip
(OpenRTM-aist C++ 1.0 RELEASE, scilab 5.3.2, OpenHRPSDK3.1 RELEASE)
rtc_scilab080.zip
(OpenRTM-aist C++ 1.0 RELEASE, scilab 5.3.2, OpenHRPSDK3.1 RELEASE)
rtc_scilab076.zip
rtc_scilab075.zip
rtc_scilab072.zip

Manual

GET START MANUAL

Japanese manual:

rtcscilab_getstart012.pdf

Tutorial

1. Launch Naming Service

Usually in Windows, [Start Button]>>[Programs]>>[OpenRTM-aist]>>[tools]>>[Start Naming Service].

2. Launch Scilab

Launch scilab in the start menu or from command line.

3. Setup RTC-scilab toolbox

Select [Menu]>>[Toolbox]>>[RTC-scilab] in your scilab environment.
Then, you can get following message:

Start RTCscilab Toolbox
Load macros
Load shared library
Load help
Load demos

check rtc.conf

Type “rtcconf_showall”.
This command checks rtc.conf file. If you do not have rtc.conf file, please input “rtcconf_generate”. This automatically generate rtc.conf file. You can check it again by the rtcconf_showall command.

Initialize RTM

Type “initRTM()”.
This process is initialize RTC-scilab by loading dynamic link library.

Create RTC

Just type…
“rtc = RTC_create()”
You can check the fact RTC is created by using RT-System Editor which is installed with the OpenRTM-aist.
The variable ‘rtc’ is used as a handle value in the following process.

Add Inport and Outport

Type …
“hInPort = RTC_addInPort(rtc, “TimedLong”, “in0″)”
The RTC_addInPort method just add the InPort to the RT-component. The second argument is type name of the DataPort, and third one is the name of DataPort.
The variable ‘hInPort’ is a handle value.
“RTC_addOutPort” method is also available. Just type….
“hOutPort = RTC_addOutPort(rtc, “TimedLong”, “out0″)”
Then you can check whether the ports are added (or not) by using RT-System Editor.

Connect InPort and OutPort

Actually RTC-scilab has CorbaNaming service function.
Type …
“cn = CorbaNaming_create(“localhost:2809″)”
“rtobject = CorbaNaming_resolve(cn, “LabRTC0.rtc”)”
“refInPort = RTObject_getPort(rtobject, “in0″)”
“refOutPort = RTObject_getPort(rtobject, “out0″)”
“refConnection = Connection_create(refInport, refOutport)”

You can also connect the ports by using RT-System Editor (this is much easier;-))

Activate RTC

Type…
“RTObject_activate(rtobject)”

You can activate/deactivate the RTC by using RT-System Editor (this is much easier;-))

Send Data

Type..
“OutPort_write(hOutPort, 3134)”

Receive Data

You can check the buffer has data or not by calling “InPort_isNew” function.
Type…
“InPort_isNew(hInPort)”
If return value is %T (true)… Then you can get the received data by calling “InPort_read” function.
Type…
“v = InPort_read(hInPort)”
Just type “disp v” will show the value.

You can refer English help by using “help” command. For example….
“Help OutPort_write”
This will give you the help document about OutPort_write function.

Please enjoy!!

If you had any questions, please contact me in any ways.
Twitter: @ysuga (this would be convenient for me!!)
Facebook: Yuki Suga

Link

Videos

Standard Usage Video

Xcos is used to create a “scope” RTC. scope is scilab tool to visualize vector data. Using scilab, RTCs’ output can be connected to the “scope” in the scilab world to visualize the sensor data. In this video, 6-axis mouse (3d-mouse) is connected to the scope.



OpenHRP3 and scilab, the dynamic simulation

In this video, the inverse pendulum is controlled by Xcos. To realize this control process, scilab world and OpenHRP3 (dynamics simulator) world must be synchronized. In RTC-scilab, clock box is provided to synchronize the time between scilab and OpenHRP3.