URBI comes with a lot of innovations, which are mainly possible because of the powerful integration of parallelism in the core of the language semantics. Here are few examples:
Broadcasting
You can group objects in 'groups' with the group command:
group myobjects { obj1, obj2, obj3 }; |
Then each time you call a method on the myobjects group or set an attribute of myobjects, you will execute the method or the assignment in parallel on each object of the group. This is a called broadcasting in URBI :
myobjects.method(42); => obj1.method(42) |
This is a very useful feature to initialize a set of motors in one line, reset some property, or execute some common code on a set of objects. Typically in a robot, body parts will be grouped into several overlaping groups.
Debugging flags
URBI Studio and other client applications offer debugging capabilities, but the URBI language itself includes some powerful monitoring features using the notion of 'flags'. Flags are used next to the command tag, to request some extra information. They are prefixed by the + sign. For example, the +begin flag will send a system message when the command starts:
if (test) => generates the following message when cmd starts: |
Flags are keywords of the language. You also have the +end and +report flags to signal the end of the command, or give a comprehensive debuging report.
Soft tests
Since URBI includes time in its semantics, it is possible to specify tests that should be true during a certain amount of time in order to trigger. This feature, known as 'soft tests' is mainly used in at commands, to implement a simple noise filter. The time of the soft test is simply given prefixed by a ~ symbol:
at (ball.visible ~ 450ms) |
Object methods specification
When you redefine in URBI a method that belongs to a plugged C++ UObject, this definition overrides the C++ definition inside the UObject, which itself overrides a definition in a remote UObject. In other words, you can completely redefine at runtime the behavior of an C++ object plugged in URBI, without even having the source code of this object.
Of course, the redefined method can itself call another method belonging to another C++ plugged/remote UObject, so you can replace C++ code by some other C++ code, which brings a lot of flexibility.
There are many others powerful features in URBI. Check the tutorial available online: