Title: Outline
1Jean-Christophe Baillie Electronics Computer
Engineering Dpt.
- Outline
- Introduction
- Language Description
- Examples
- Liburbi
- Soft Devices
- Conclusion
Ecole Nationale Supérieure des Techniques
Avancées Paris, France
2Introduction
- URBI is an Interface Language to control robots
- Key features
- Simplicity easy to understand, but with high
level capabilities - Flexibility independant of the robot, OS,
plateform, interfaced with many languages (C,
Java, Matlab) - Modularity soft devices to extend the language
- Parallelism Parallel processing of commands,
concurrent variable access policies, event based
programming,
3Devices
Every sensor, motor, camera or physical hardware
in the robot is a device.
A device is similar to a C object it has
methods and properties.
The val property is related to the device value
(telnet session, port 54000, with Aibo
ERS7) headPan 15 // or headPan.val
15 headPan 136901543notag 15.1030265089
accelX 136901543notag 0.002938829104
camera 145879854notag BIN 5347 jpeg 208
160 5347 bytes speaker
bin 54112 wav 2 16000 16 54112 bytes
4Messages
All messages from the server are composed with
the same standard structure
headTilt 136901543notag 15.1030265089
the command to the server
the message from the server
Time stamp (ms)
Command tag
Message content
mytag headTilt 136901543mytag 15.1030265089
custom tag useful to know who is sending what
5Advanced Tagging
stop / block / freeze
mytag commands... stop mytag // stops
the commands block mytag // kills any new
command with tag "mytag unblock mytag freeze
mytag // freeze any running or new
command unfreeze mytag
Flags tag modifiers
error command // reports errors begin
command // reports beginning of the
command end command // reports ending of the
command
6Complex Assignments
Simple assignment
headPan -2
Numerical assignments can be specified via
modifiers
This command never terminates
7Time Operators
Commands can be executed in serial or parallel
mode
headPan 15 neck 30
Set headPan to 15 and neck to 30 at the same time
headPan 15 neck 30
Set headPan to 15 and after, set neck to 30.
8Variable Properties Extensions
Variables can be assigned several properties,
using the -gt indirection
myvar-gtrangemin x
Stores the min range for the variable myvar
myvar-gtrangemax 145
Stores the max range for the variable myvar
device.val-gtspeedmin 24.4
Speedmin is the minimal speed value (units/s)
Variables in URBI are not simple containers like
in C or similar languages they are dynamic
structures evolving over time.
device-gtspeedmax 112
Speedmax is a hard limit on the variable
derivative.
neck.val-gtunit "deg"
Variable unit (for information only)
neck.val-gtdelta 12
Variable tolerance used in adapative mode
neck.val-gtblend normal
Variable blend mode (next slide)
Variables evaluation can be specified using
extensions
myvar device.x
First/Second order derivative,from assignments
First/Second order derivative of device.val,from
sensors
device.vald device.valdd
neckn
Normalized value (using rangemin/rangemax)
necke
Assigned measured error (approx. torque
measure).
9Blending modes
Conflicting assignments can occur from several
clients or inside the same program. How to handle
it?
Blending modes
neck-gtblend add
Each assignment occurs at the same time and is
added to the others gt Used for walk sequences
neck-gtblend mix
Like add, but they are averaged instead of added
neck-gtblend queue
Each assignement occurs only when the others are
finished
neck-gtblend discard
Each conflicting assignment is ignored
neck-gtblend cancel
Each new assignment terminate any other pending
assignment
neck-gtblend normal
The latest assignment has the focus, be the
others run in background
NB this is also true for sound devices gt simple
multiplexer
10Device Grouping
Devices can be grouped into virtual devices to
form a hierarchie
group legLF lefLF1, legLF2, legLF3 group legs
legLF, legLH, legRF, legRH
legs
legLF
legLH
legRF
legRH
legLF1
legLF2
legLF3
Commands go down the hierarchy, allowing useful
factorizations
legs.PGain 0 // will affect the P Gain of all
sub devices
11C-like Features
Function definition Functions can be defined on
devices or virtual devices
Control structures Standard control structures
are available and some more specific to URBI
def robot.walk (x,y) / walk
code/ def add (x,y) return
xy def fibo(n) if (nlt2) return 1
else a fibo(n-1) b fibo(n-2)
return ab
// the classical for loop for (i0ilt10i)
echo i // soft tests must be true for
3ms while (headsensor gt 0) instructions //
loop 10 times loopn (10) legLF1 legRF1 //
Funny average calculation with for avg
0 avg-gtblend mixfor (i0ilt10i) avg
tabi
no semicolon
usage
robot.walk (14,255) myresult
fibo(10) robot.process_mystring("bonjour")
12Event catching
Several event catching mechanisms are available
A will be executed once when test becomes true.
Then, as soon as test becomes false, B is
executed and the server waits for test to be true
again. test can be set with an hysteresis on the
number of successful test checks or time.
When test becomes true, A is executed. When A is
finished, it is executed again if test is still
true, otherwise, B is executed.
waituntil (test)
Terminates only when test becomes true. gt If
given a number, the wait command pauses for this
nb of ms.
usage
waituntil (test) instructions
13Event catching (2)
You can control the lifespan of a command
14Event catching(2)
You can emit your own events with the emit
function
15Advanced Features
Many other advanced features Interconnection
commands, variables by name, aliases, load/save
files, def checking, debugging options,
None of these are required to move a
joint! joint.val 30
16Examples with Aibo
// The ball tracking head program whenever
(ball.visible) headPan headPan
camera.xfov ball.x headTilt
headTilt camera.yfov ball.y
// Stand up (leg1, leg2 and leg3 are virtual
devices defined elsewhere) getup leg2
90 time2s leg3 0 time2s leg1
90 time1s leg2 10 time1s leg1 -10
time2s leg3 90 time2s
// record and play a sound for 10s sound bin
0 // an empty buffer to store the
soundtimeout(10s) loop sound sound micro //
record the sound...speaker sound // ...play
it
17Walk Sequence
Simple walk Using an original walk from the
robocup, we extracted the two main Fourier
coefficients for each joints. With blend add
mode, these two components are added on each
joint to reproduce the original periodic
oscillation
def robot.walk(duration) echo "go for "
string(duration) " secs" direction 1 if
(duration lt0) duration - duration,
direction -1 walk timeout(duration)
for (x1xlt2x) for
(y1ylt2y) for (j1jlt3j)
for (d1dlt2d)
robot.legxyj walk.meanxj
sinwalk.speedwalk.coefd
ampliwalk.ampxjd4 phasedirecti
onwalk.phasexyjdpi(direction-1)/2
18Behavior example
This example shows how to write behavior
graphs with URBI
// Tracking state def tracking() whenever
(ball.visible) headPan headPan
camera.xfov ball.x headTilt headTilt
camera.yfov ball.y // Searching
state def searching() period 10s
headPann 0.5 smooth1s headTiltn 1
smooth1s headPann 0.5 sinperiod
ampli0.5 headTiltn 0.5 cosperiod
ampli0.5
// Transitions track_transition at
(ball.visible 400ms) stop search
speaker found track tracking()
search_transition at (!ball.visible
400ms) stop track speaker lost
search searching()
19Liburbi quick review
Telnet is of course too limited gt liburbi for
C programming. Exists also for JAVA, Matlab
and OPENR (soon Python, C) The URBI library
(liburbi) give simple methods to send commands to
and receive messages from the URBI server.
client-gtsend(" headPan d", x)
client-gtsyncGetDevice("neck",neckVal) // exists
also for binary
client-gtsetCallback(receiveMyImage,"imgtag")
client-gtsend("loop imgtagcamera.val")
20How to use URBI?
URBI Server
- simple commands
- functions definition
- complex scripts
other integrated clients (matlab, python, . . .)
21Making reusable software modules
Algorithm results as URBI variables Ex ball.x,
ball.y, ball.size
External client module
Compute some complex function, algorithm or
signal processing task. Example a ball tracking
algorithm. Activity script loop
modulenamecamera Controlled by block
modulename stop modulename
URBI Server
Sensors or variable values Ex camera.val
22Soft Devices
The creation of soft devices extends the
devices available in the robot. This is done by
creating a subclass of USoftDevice. Soft devices
can monitor variables, redirect function calls
(C/URBI binding) and events relative to
them. Example ball gt ball.x, ball.y voice
gt voice.say(hello), voice.hear(x)
23Soft Devices (2)
Proxy
Extern Soft Device
Proxy Server
URBI Server
Extern Soft Device
Extern Soft Device
Kernel plugins
Integrated Soft Device
URBI Server
With the URBI Module Library the same C code
for all integration possibilities
24Demo
Short demo video
25Conclusion
-
URBI Server for Aibo liburbi are freely
available for non commercial use at - www.urbiforge.com
- Next steps
- Support more robots and develop
partnership/contracts with robot manufacturers - Currently Aibo, HRP-2, Webots5 (robot simulator,
Cyberbotics), ENSTAR, - Aldebaran Robotics, Pioneer robots.
- Next Sony, Philips iCat?
- Increase the number of languages for the
liburbi. - Currently C, Java, Matlab, C/OPENR.
- Next Python, C, perl
- Continue to add important features in the
kernel client functions, debugging facilities,
multi tagging, kernel 2 with multicore processors
support and real-time scheduling. - Develop URBI modules to enhance the language and
stimulate the community (GPL) - Develop useful associated software tutorials
URBI Lab, URBI center, URBI Dev
26at (talk.finished true) echo Thank you
for your attention
27Performances
Test on a wifi 802.11B wireless connections, with
a URBI server for ERS7, a linux C client and
tests with both the client and the server on the
robot, and OPEN-R based connection.
OPEN-R
TCP/IP
Latency
1.5ms 0.5 Bandwidth
500Ko/s
Latency
600 µs Bandwidth
2Mo/s
Jpeg compress (90) 10ms for
208x160
3ms for 104x80
30 motor commands per second per motor 208x160
jpeg92 30fps
Good performances in general. For highly
demanding low level action/perception loops, the
best is to run some URBI Clients on the robot and
leave the high level slow control architecture
offboard.