developer’s guide - robotshop...2 developer’s guide - c++, urbi, flex, java - v2.0 robopec this...
TRANSCRIPT
robopec
Developer’s guide
C++, Urbi, Flex, Java
2
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Summary 1 General ............................................................................................................................................ 3
2 Reeti’s architecture ......................................................................................................................... 4
2.1 Hardware ................................................................................................................................. 4
2.2 Ubuntu ..................................................................................................................................... 4
2.3 Urbi .......................................................................................................................................... 5
2.4 URBI’s principles ...................................................................................................................... 5
2.5 Possible developments on Reeti ............................................................................................. 5
3 Reeti’s tree ...................................................................................................................................... 6
3.1 reetiDocuments ....................................................................................................................... 6
3.2 reetiPrograms .......................................................................................................................... 7
4 Flex Interface creation ..................................................................................................................... 8
4.1 Flex Development environment .............................................................................................. 8
4.2 Flex Reeti Application: RApplication ....................................................................................... 8
4.3 Flex Stand-alone Application ................................................................................................. 11
4.4 Useful functions of PublicGUITool ......................................................................................... 12
4.4.1 class Communication ..................................................................................................... 12
4.4.2 EventDataReception class ............................................................................................. 13
4.4.3 Translator class .............................................................................................................. 13
4.4.4 Header class ................................................................................................................... 13
5 C++ Standalone Applications (C++ liburbi) ................................................................................... 14
6 Java Standalone Applications : JAVA liburbi .................................................................................. 15
7 C++ URBI modules ......................................................................................................................... 16
7.1 Create a URBI module ........................................................................................................... 16
7.2 Load a module at Reeti Launch ............................................................................................. 19
8 The URBIscript ............................................................................................................................... 20
9 ROS compatibility .......................................................................................................................... 20
10 Main Reeti Functions and variables .......................................................................................... 21
11 Contacts and complementary Information ............................................................................... 23
3
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
About this guide:
In order to reduce our paper consumption and according to our responsible and
respectful measures for the environment, Robopec prefers to put online those
documents for users instead of printing them.
You can find more information on the website www.reeti.fr on which you will find more examples,
tutorials, FAQ, and a Forum for Assistance.
Read carefully this guide and respect the instructions of use in the guide: “Regulations
and Warranty” before any use of Reeti. Robopec won’t hold responsibility for any
dysfunction in case of non-respect of those instructions.
Every modification of source code or add in functionality on Reeti is made at the
developer’s own risks. Robopec takes every measures to prevent malfunction on Reeti
and could not be blamed for dysfunction on Reeti in case of modification, alteration,
deletion or add of codes.
1 General
4
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Figure 1 Reeti’s architecture
2.1 Hardware
Hardware is every device which equipped Reeti. It includes his motherboard, his power board , his
speaker, his robotic head.
2.2 Ubuntu
Reeti operates a Linux Ubuntu 14.04 Trusty.
2 Reeti’s architecture
Reeti’s iphone App
network
URBI console
FLEX interface
5
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
2.3 Urbi
All the functionalities on Reeti have been developed on URBI, a middleware by GOSTAI.
(http://www.gostai.com/products/urbi) allowing to easily develop robotics codes.
When starting, Reeti runs an URBI server and loads Modules and URBI script functions containing
the functionalities of Reeti. Reeti gets his order from interfaces that act on the server. A local
interface (IHM Flex, console URBI) or a mobile one (iPad/iPhone) can send orders to Reeti via the
Urbi Server.
Lots of functionalities are natively available on Reeti and are introduced later in this document. An
exhaustive list of functions is available on the API :
on reeti open /home/reeti/reetiDocuments/DevelopmentDoc/ReetiAPI/index.html.
2.4 URBI’s principles
URBI works as a code interpreter: you send the code to a central server and it will be interpreted. The
instructions can be sent through several channels:
- through Urbi’s debug console
- through a remote TCP/IP connection
- through libraries
URBI includes natively a number of built-in instructions, but it is possible to create your own
instructions to complete and enrich the interpreter code. For more information see directly the
UrbiSDK document available on Reeti.
2.5 Possible developments on Reeti
There are three axis of development in Reeti:
- New Interfaces: graphical software to use Reeti’s functionalities (Flex, iPad/ iPhone).
- New functions: giving Reeti new functionalities (Modules, URBIscript)
- New Standalone applications: integrate interactions with Reeti in your own application
6
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Reeti has a development’s tree that makes it easy to find the necessary elements for development.
3.1 reetiDocuments
Documents or content files (poses, sequences, TextToSpeech, video, images ...) used by Reeti must
all be placed in the directory /home/reeti/reetiDocuments and under the corresponding directory.
Figure 2 Tree of home/reeti/reetiDocuments
Doc : help and samples documentation
Moves : urbi scripts to be used in RShowmaker
Music, Pictures, Video : multimedia content
Poses : poses for Reeti attitude and sequences
Sequences : sequences for Reeti animation
Script : linux scripts
TTS : text to Speech
3 Reeti’s tree
7
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
3.2 reetiPrograms
Your own programs developments should be placed in /home/reeti/reetiPrograms.
Figure 3 Tree of /reetiPrograms
bin: executable files of external programs required by your application
configuration : configuration files of your applications
data : data files generated or required by your applications
functions : your urbiScript functions
kernelModules : linux kernel modules you may have created
load : init files to load your own modules at Reeti launch
logs : place to put your applications logs
RApplications : Flash applications
o Icons : Icons for your applications
o Applications : swf files for your flash modules
o Translation : Translation files for your applications
scripts : Directory for your scripts (sh, bash)
UModules : Directory for your Umodules
8
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
You can create two types of Reeti applications: a desktop application or an application for Reeti’s
Launcher integrated in the Reeti’s framework.
4.1 Flex Development environment
We use Flash Builder 4 on a windows computer.
We made a procedure to produce a fake reeti files tree on your windows computer in order to be
able to run your flex development directly in Flash Builder. You will find files and instructions in
/home/reeti/reetiDocuments/Doc/Help/Flex Development kit
4.2 Flex Reeti Application: RApplication
Reeti's home when starting Reeti is a wrapper of OS coded in Flex. Reeti's home is an application that
can launch other AIR/Flex applications created following the outline Reeti.
To create a new application on Reeti you have to do two things:
- Create the application with Reeti’s outlines
- Add the application to the Launcher by using RConfiguration tool
A Reeti application needs three files to be used by Reeti:
An image file:
o Extension *.png, *.jpg : the image representing the application
o Format : 205 pixels x 165 pixels
o Colors :
Robotic application: White on turquoise
Configuration application : White on orange
System function: Logo of the function on white
A translation file
Allows you to translate your application in various language: it currently supports French and English
- Extension XML:
<?xml version="1.0"?>
<content>
<french>
<name_nom_application>nom</name_nom_application >
<bonjour_nom_application>Bonjour</bonjour_nom_application>
</french>
<english>
4 Flex Interface creation
9
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
<name_nom_application>name</name_nom_application>
<bonjour_nom_application>Hello</bonjour_nom_application>
</english>
</content>
Translation files for all applications are merged into a single database on Reeti. This allows you to
reuse the translations from other applications. Nonetheless, if the same xml tag is present in two
files, only one translation will be taken into account, that of the first file loaded. That is why we
recommend you to add the name of your application to your tag, if the translation is special:
Ex : To translate “yes”, you can use:
<yes>oui</yes>
<yes>yes</yes>
Because “yes” is quite general for all applications
But to translate: « Yes ! Of course. », our advice is to use:
<yes_mon_appli>Oui ! Bien sûr.<yes_mon_appli>
<yes_mon_appli>Yes ! Of course.<yes_mon_appli>
Because this sentence is dedicated to one application.
Conventionally, the translation file is named after your application as xml file: (RRobotFoo.xml for an
application named RRobotFoo).
Flash application file
This file .swf contains the flash application.
To create a compatible application, you have to follow these steps:
- Create your application as a RApplication (class in the PublicGUITools library)
o Your application must implements the variable m_appName : the name of your
application conventionnaly beginning by an R :
m_appName="RMy_application "
- Add a Header components from PublicGUITools. You have to fill:
o Title of your application: title= ‘‘name‘‘
o A function prevClick allowing you to go back to Home
- You can then send instructions to Reeti by using the following function :
o FlexGlobals.topLevelApplication.socket.write("Global.servo.leftEar=10;");
Example:
<?xml version="1.0" encoding="utf-8"?>
<!—Loadable Application by Reeti Launcher -->
<local:RApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
10
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:local="*"
creationComplete="creation()"
xmlns:components="components.*"
m_appName="RTip"
>
<fx:Script>
<![CDATA[
/** Callback on application creation:
/* Initialization of button label to “suppr” entry in translation file
*/
protected function creation():void
{
but.label=translation.getTranslation().suppr;
socket.write("Global.servo.leftEar=10;");
}
/**
/* On click on home button, go back to reeti’s home
*/
protected function header1_prevClickHandler():void
{
var eventObject:Event=new Event("homeClick");
parent.dispatchEvent(eventObject);
}
]]>
</fx:Script>
<!—Header component -->
<local:Header prevClick="header1_prevClickHandler()"
title="RTip" />
<s:Button id=”my_but”/>
</local:RApplication>
Add your application to the Launcher
To add your application to the Launcher, you have to go to the RConfiguration application on your
Reeti, Launcher Configuration then add an application to the board by picking the three files you just
created.
11
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
4.3 Flex Stand-alone Application
A stand-alone application is an AIR application on which you add classic order’s dispatch features to
Reeti using the class "communication" in the library PublicGUITools provided on Reeti.
Be careful, class communication can only be used locally on AIR and Reeti. The use of class
communication in a Flash or AIR project on another machine than Reeti is currently not
supported and will not work.
Steps to create a fully Reeti compatible application are the following:
- Create a <s:WindowedApplication>
- In <fx:Script> , declare an instance of communication class :
o private var com:Communication;
- After the creation of the application, instantiate your object:
o com = Communication.getInstance(0);
Communication class is a singleton, getInstance is the only way to instantiate it
correctly.
- Communication will try to establish and a EventDataReception event will be emitted. You
can get back it thanks to :
o com.addEventListener("connection", changeConnection);
If message is 0, connection is not done.
If message is 1, connection is established.
If message is 2, connection failed.
- Use the « com » object to communicate with Reeti using:
o com.write("order_for_reeti");
Example:
<!--Initialization -->
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
applicationComplete="creationCompleteHandler()"
xmlns:components="components.*"
>
<fx:Script>
<![CDATA[
//We declare a communication available just from this component
private var com:Communication;
//Callback on end of application initialization
public function creationCompleteHandler():void
12
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
{
//We instantiate the object Communication
com = Communication.getInstance(0);
//On change on connection
com.addEventListener("connection", changeConnection);
}
//Callback on change on connection
private function changeConnection(ev:EventDataReception):void
{
//If connection is ok, moves Reeti’s ear
if (int(ev.message)==1) com.write("Global.servo.leftEar=10;");
}
]]>
</fx:Script>
</WindowedApplication>
4.4 Useful functions of PublicGUITool
4.4.1 class Communication
Events:
- class Communication sends the event dataReceived. DataReceived contains an object
EventDataReception which message is the message received from Reeti.
Use: Listening the event:
socket.addEventListener("dataReceived", reception);
and reception function:
private function reception(ev:EventDataReception):void
{
if(ev.message.search("automaticBehaviour")>-1)
{
if(ev.message.search("false")>-1)
{
automaticBehaviour=false;
}
else if(ev.message.search("true")>-1)
{
automaticBehaviour=true;
}
}
}
13
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
On data reception, the application calls « reception » function which checks the message and
executes the code.
4.4.2 EventDataReception class
Event contening a message in the field message.
Example :
dispatchEvent(new EventDataReception("event",true,true,"my_message"));
my_component.addEventListener("event", my_function);
First line is for dispatching an event named “event” with message “my_message”.
Second line will execute the function my_function when the component my_component receive the
event “event”.
4.4.3 Translator class
To accede to the translation in the translator class, you have to use the method getTranslation() then
the name of the xml tag you put your translation in:
translation.getTranslation().tag_xml.
4.4.4 Header class
The Header class is instantiated in all applications and allows an identic canvas on all applications.
Some functionalities have to be present on all applications and are grouped in this class. It has six
elements:
Figure 4 Header class view
Name Type Attribut Type Effect Event Send back Function
butPrev Button - - - prevClick Event Back to home
title Label - - - - - -
butNew Button newButtonVisible bool Show/ hide
button
newClick Event New element
butRec Button recButtonVisible bool Show/ hide
button
recClick Event Save
butLoad Button loadButtonVisible bool Show/ hide
button
loadClick Event Load element
butConfig Button configButtonVisible
bool Show/ hide
button
configClick Event Configure
14
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Gostai gives access to libraries that allow communication with URBI server through C++ or JAVA
software. These functionalities are wrapped in C++ in liburbi and in JAVA in liburbijava.
In order to communicate with URBI in C++, follow these steps:
- Create your C++ software
- Include UClient header :
o #include <urbi/uclient.hh>
- Declare a Urbi client:
o UClient * client;
- Instanciate the UClient with IP and port. The IP and the port of Reeti or available in the
variable IP and portUrbi :
o client=new urbi::UClient(string _IP, int _port);
- Send your orders to Reeti :
o String cmd = "Global.servo.changeLedColor(\"red\");";
o client->send("%s", cmd.c_str());
- On compiling, include the library /usr/local/gostai/lib/liburbi.so
Example :
#include<urbi/uclient.hh>
#include <string.h>
using namespace std;
using namespace urbi;
int main(int argc, char** argv)
{
UClient * client;
client=new UClient("127.0.0.1", 54001);
String cmd = "Global.servo.changeLedColor(\"red\");";
client->send("%s", cmd.c_str());
return 1;
}
5 C++ Standalone Applications (C++ liburbi)
15
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Gostai gives access to libraries that allow communication with URBI server through C++ or JAVA
software. These functionalities are wrapped in C++ in liburbi and in JAVA in liburbijava.
You can contact Reeti via a program developed in JAVA. For that, it is necessary to have the Java
Development Kit (JDK v1.6 minimum) and Java Runtime Environment (JRE v1 .6 minimum).
To create a Java program for Reeti, create a standard Java project, then:
- Add the urbi Java library import urbi.UClient;
- Declare a Urbi client: public Uclient cli ;
- Instantiate-it precising the Ipv4 address, the port and buffer size : cli = new UClient(‘‘127.0.0.1‘‘, 54001, Uclient.URBI_BUFLEN) ;
- Send orders to Reeti : Syntaxe : cli.send(‘_MA COMMANDE ; ‘‘) ;
Exemple : cli.send(‘‘wall(‘‘\ Mon Premier message Java \‘‘);‘‘);
Program is ready to communicate with Reeti. Three different compiling methods exist.
- By command line:
Use command line « javac ». Don’t forget the option -Djava.library.path="<urbi-root>/lib".
- Under NetBeans (v 6.5 minimum)
Once you project created and opened, follow these steps:
- Right click on project name => Properties
- In libraries tab, click « Add JAR/Folder ». Choose Urbi Library named « liburbijava.jar » (on
SDK 2.6, library is in <urbi-root>/share/urbi-sdk/java/lib/) - In tab Run, in « VM Options », enter: -Djava.library.path="<urbi-root>/lib" - Compile
- « umake-java » method There is a third method. This is the command urbi "umake-java". For more details on this method,
thank you for looking in the Urbi manual documentation (for version 2.6, this is page 52 of the SDK
pdf).
6 Java Standalone Applications : JAVA liburbi
16
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
An URBI module is a C++ library that will allow you to add instructions understood by the URBI
server. Instructions can be of two types:
- variables
- functions
7.1 Create a URBI module
Declare a class as URBI module
For a class to be loaded and interpreted by a module URBI, you must do as follow when creating it:
- Includes library urbi/uobject.hh (in /usr/share/gostai/includes) :
o #include <urbi/uobject.hh>
- Inherits your class from UObject :
o class ma_classe: public urbi::UObject{
- Create a public function init taking as arguments those you would use in traditional
constructor (returning 1 on fail, 0 on success):
o int init() ;
- Your real constructor must bind the function init and use UObject constructor:
ma_classe::ma_classe(const string &n):UObject(n)
{
UBindFunction(ma_classe, init);
}
- Declare your class to URBI server
o UStart(ma_classe);
Declare a variable
You can declare in C++ code variables understandable by URBI:
- Create a variable UVar :
o UVar something;
- Declare this variable to the server :
o UBindVar(ma_classe, something);
If your variable changes in your program, it will also change in the interpreter URBI. UObject class
includes in particular a useful function: UNotifyChange. This function creates a callback on any
changes in the value of the variable.
Call : UNotifyChange(something, &ma_classe::somethingChange);
When something changes, function somethingChange is called:
Prototype : int ma_classe::somethingChange(UVar& var)
7 C++ URBI modules
17
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Declare a function
In your class, you can create all functions as normal, but if you want a function to be accessible by
URBI, you must declare it as:
- Declare your function public.
- Declare your function to URBI :
o UBindFunction(ma_classe, ma_fonction);
- The binded function accepts only the following types of arguments:
o int
o double
o string
o std::list
o URBI type (see URBI documentation)
You can declare your functions to be called in a separate thread:
UBindThreadedFunction(ma_classe, ma_fonction, LOCK_NONE);
Call URBI function
Use the liburbi C++ as in chapter 5 to call URBI functions in your module.
Compilation
To compile, use the umake tool from URBI or compile your project as static library (.so) including
/usr/local/gostai/lib/liburbi.so and /usr/lib/libpthread.so in compilation libraries.
A cmake template with samples is given to easily compile your projects.
Example :
Header file: Ma_classe.h
#ifndef MA_CLASSE_H
#define MA_CLASSE_H
#include<string.h>
#include<iostream>
#include<stdio.h>
// headers inclusions
#include<urbi/uobject.hh>
#include<urbi/uclient.hh>
using namespace std;
//namespace URBI
using namespace urbi;
//our class inherits from UObject
class Ma_classe:public UObject{
public:
//default constructor, always with an argument : const string&
18
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Ma_classe(const string &n);
// ‘‘Real’’ constructor URBI taking an int and a string
int init(string _IP, int _port);
//A declared function to URBI
int play(string _str);
private:
// client to send orders to URBI
UClient * client;
//Classical function
void do();
// UVar declared to URBI
UVar something;
// Callback function on « something » changes
int somethingChange(UVar& var) ;
};
#endif
Source file: Ma_classe.cpp
#include"Ma_classe.h"
//Declaring our class to URBI
UStart(Ma_classe);
//constructeur declaring init to URBI
Ma_classe::Ma_classe(const string &n):UObject(n
{
UBindFunction(Ma_classe, init) ;
}
//Init function
int Ma_classe::init(string _IP, int _port)
{
// client initialization
client=new urbi::UClient(_IP.c_str(), _port);
//Declaring play to URBI
UBindFunction(Ma_classe, play) ;
//Declare something to URBI
UBindVar(Ma_classe, something) ;
//Création d’une callback sur la variable something
UNotifyChange(something, &Ma_classe::somethingChange);
}
// play function binded to URBI
int Ma_classe ::play(string _str)
{
if(_str==””) do;
else cout<<_str<<endl;
return 1;
19
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
}
//function do
void Ma_classe::do()
{
//launch do_something() to URBI
Client->send(”do_something();”);
}
//Function calledas soon as something variable changes
int Ma_classe::somethingChange(UVar& var)
{
//Get the UVar in a classical type
int a=static_cast<int>(var);
cout<<a<<endl;
}
7.2 Load a module at Reeti Launch
Once your module is compiled as a dynamic library (e.g. libMACLASSE.so) you have to declare your
module to URBI. You have to add to /home/reeti/reetiPrograms/load/InitModule.u these lines:
loadModule("/chemin_vers_votre_lib/libMACLASSE");
var Global.mon_nom = uobjects.Ma_classe.new(IP, portUrbi);
Directory /home/reeti/reetiPrograms/UModules is dedicated to your modules. The directory
/home/reeti/reetiPrograms/data is dedicated to the data used by your modules.
Now, you must restart your console URBI to make your changes effective and your module loaded.
To do this, pass to dev mode (in Configuration) and launch reetiDev.sh script (default password:
reeti).
In developer mode, you have access to URBI console giving information and allowing you to
manipulate files and software more easily.
In console mode, Reeti does not take care of handling the Launcher, so be careful. To
get back with all functionalities, restart Reeti.
Then, to use your new functions:
- Global.mon_nom.play(“Coucou”) ;
- Global.mon_nom.something=5;
20
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
First you need to learn the URBIscript language:
- refer to URBI Documentation /home/reeti/ReetiDocuments/Help/
- try the special Reeti Urbiscript tutorial : /home/reeti/ReetiDocuments/Sample/Urbi/script/
Procedure to integrate your functions at Reeti launch :
- Put your function in a .u file
- Copy it in /home/reeti/reetiPrograms/functions/
- Edit /home/reeti/reetiPrograms/load/functions.u
- Add a new line containing : load(‘’/path/to/your/file”);
- Restart your Urbi server
You can now use your function in a URBI console or through another interface.
We don’t yet have a real API for ROS but REETI is compatible with ROS and can be interfaced to it.
An example of a ROS node implementing a service is given in :
home/reeti/reetiDocuments/Doc/Sample/ROS
It is also possible to use ROS in the urbi development : refer to Urbi documentation chapter II-14.
8 The URBIscript
9 ROS compatibility
robopec
Here we present a list of key features of Reeti API..
For complete documentation, please refer to html API in /home/reeti/reetiDocuments/DevelomentDoc/ReetiAPI/index.html
Function Sending Use Example
server.systemLaunch(string) 0 : success 1 : failure
Executes system code Global.server.launch(‘’mkdir my_file‘’) ;
server.loadScript(string) 0 : success 1 : failure
Loads and play the file in argument Global.server.loadScript(“/home/reeti/ma_fonction.u”);
servo.neutralPosition() - Put Reeti in neutral position
Global.servo.neutralPosition() ;
servo.moveTo(double) - Put all the axis to desired position
Global.servo.moveTo(52.2) ;
servo.changeLedColor(string color) - Lights up the 2 LED to asked color. Available colors are red, green, light green, blue, dark blue, turquoise, yellow, violet, white.
Global.servo.changeLedColor(“red”) ;
servo.changeLedColorRGB(int _index, int R, int G , int B, double _intens)
- Lights up the LED _index to color RGB and intensity _intens _index: 0 for both, 1 for right, 2 for left
Global.servo.changeLedColorRGB(1,0,25,21,0.5) ;
tts.say(string) - Speaks the sentence
Global.tts.say(‘Hello’’) ;
tts.sayWithSynchro(string) - Speaks the sentence and moves the lips Global.tts.sayWithSynchro(‘’hello) ;
player.playPose( string _posePath) Play a Reeti pose (.load file) from the directory /home/reeti/reetiDocuments/Poses
Global.player.playPose(“mypose.load”)
player.playSequence (string _sequencePath)
Play a Reeti sequence from the directory /home/reeti/reetiDocuments/Sequences
Global.player.play.playSequence("my_sequence")
10 Main Reeti Functions and variables
22
Developer’s guide - C++, Urbi, Flex, Java - V2.0
robopec
This document is the property of Robopec. The information contained herein may not be used, reproduced or
communicated without its prior written consent.
Variable Type Use Callback Example
clock.day int Day of the month (1-31) - Global.clock.day ;
clock.month int Month of the year (1-12) - Global.clock.month ;
clock.year int Year (YYYY) - Global.clock.year ;
clock.weekday Int Weekday (1-Monday-7-Sunday) - Global.clock.weekday ;
clock.hour int Current hour (0-23) - Global.clock.hour ;
clock.minute int Current minute (0-59) - Global.clock.minute;
clock.second int Current second (0-59) - Global.clock.second;
clock.age int Age of Reeti in months - Global.clock.age;
servo.color double Value of the cheek color servo.changeLedColor(string color) Global.servo.color=”red” ;
servo.neckRotat double Value of the neck rotation (0-100) Moves the neck to value Global.servo.neckRotat=20 ;
servo.neckTilt double Value of the neck tilt (0-100) Moves the neck to value Global.servo.neckTilt=20 ;
servo.neckPan double Value of the neck pan (0-100) Moves the neck to value Global.servo.neckPan=20 ;
servo.leftLC double Value of the left lip commissure (0-100) Moves left commissure Global.servo.leftLC=20 ;
servo.rightLC double Value of the right lip commissure (0-100) Moves right commissure Global.servo.rightLC=20 ;
servo.bottomLip double Value of the bottom lip (0-100) Moves bottom lip Global.servo.bottomLip=20 ;
servo.topLip double Value of the top lip (0-100) Moves top lip Global.servo.topLip=20 ;
servo.leftEar double Value of the left ear (0-100) Moves left ear Global.servo.leftEar=20 ;
servo.rightEar double Value of the right ear (0-100) Moves right ear Global.servo.rightEar=20 ;
servo.leftEyePan double Left eye pan position (0-100) Moves left eye horizontally Global.servo.leftEyePan=20 ;
servo.leftEyeTilt double Left eye tilt position (0-100) Moves left eye vertically Global.servo.leftEyeTilt=20 ;
servo.leftEyeLid double Left Eye lid position (0-100) Moves left lid Global.servo.leftEyeLid=20 ;
servo.rightEyePan double Right eye pan position (0-100) Moves right eye horizontally Global.servo.rightEyePan=20 ;
servo.rightEyeTilt double Right eye tilt position (0-100) Moves right eye vertically Global.servo.rightEyeTilt=20 ;
servo.rightEyeLid double Right eye lid position (0-100) Moves right lid Global.servo.rightEyeLid=20 ;
robopec
The Reeti is designed by Robopec, SARL with a capital of € 22 000, registered in the Trade and
Companies of Toulon under number 508 693 470 0002 5, whose head office is located at 183 chemin
des Négadoux - 83140 - Six Fours Les Plages - France.
You can contact Robopec or for more information about the Reeti on www.reeti.fr or by writing to
The pictures in this manual are not contractual.
11 Contacts and complementary Information