URBI handles command parallelism in a very simple way. Parallelism is enforced through various command separators :
As usual in programming languages, two commands separated by a semicolon ";" will be executed one after the other :
wheels.speed = 100; wait(2s); wheels.speed = 0;
will turn the wheels, wait 2 seconds and then stop.
In URBI, two commands separated by "&" will be executed in parallel and will start exactly at the same time :
wheelL.speed = 50 & wheelR.speed = -50;
will move at the same time the left wheel forward and the right wheel backward (so the robot will turn).
The comma "," makes the first action to go in background and starts the next one as soon as possible, without enforcing a simultaneous start of the two commands :
wheelL.speed = 50 time:10s, wheelR.speed = -40 time:10s,
will not wait that wheelL grows to 50 to make wheelR decrease to -40, but will not enforce that the commands terminate at the same time, which would be the case with the "&" separator.
This explain why the comma was necessary in the previous section. If
we finish a command that last forever with a semicolon, the server
will wait forever before starting a new command. If you happen to
make this mistake, it is still possible to open a new connection to
the URBI server using another client and using the stop
tag; command.
Here is an example where we use parallelism to move the tribot awkwardly while playing sounds :
wheelR.speed = 0 sin:3s ampli:50 & wheelL.speed = 0 sin:4s ampli:30 & beeper.play(200,3s),
Parallelism handling is a key feature of URBI, which has in fact four command separators. See the URBI tutorial available at http://www.gostai.com/doc.php for more information.