As in most programming language, it is possible to write functions in URBI. The functions are useful for making more complex programs where the same commands are used several times.
The following example defines a function which moves the robot for a given time at a given speed :
function global.forward(speed,timer)
{
wheels.speed = speed;
wait(timer);
wheels.speed = 0;
},
Once defined, this function can be called simply :
global.forward(100,3000);
More details about functions, objects and variables in URBI are available in the URBI tutorial (http://www.gostai.com/doc.php).