Improving the movements

The commands given so far simply set a speed to the wheels, but you can use URBI to make precise sequences of movements. It is for example possible to set a speed for a given time, then stop.

To achieve that, URBI provides a command to wait for a given time : sleep(duration). And you can make sequences of commands separated with semicolon that will be executed one after another. So the following line :

  wheels.speed = 50; (10s); wheels.speed = 0;

will make the robot to go forward during 10 seconds then stop.

It is also possible with URBI to control the way the values will change. In the previous examples, the motor speed goes from 0 to 50 as fast as possible. You can use a modifier to the variable assignation to control the way the variable value will change. For example, if you want to reach a value in a given time, use the time: modifier :

  wheels.speed = 50 time:3s; wheels.speed = 0 time:3s;

Using this code, the robot will accelerate to reach the speed of 50 after 3 seconds, then slow down to stop after another 3 seconds.

Other modifiers are available in URBI, they are described in the URBI tutorial available at http://www.gostai.com/doc.php.