Chapter 3. First steps with URBI to control Mindstorms NXT

Table of Contents

Make basic movements
Improving the movements
Reading sensors
Tagging commands
Playing sounds
Cyclic moves
Parallelism
Using functions
Loading files
Conclusion

This section is a short tutorial for using URBI with the Lego TriBot model with the default configuration provided with the URBI server. Users familiar with URBI should look directly to the next section for an extensive list of the available devices.

Make basic movements

We will first move the wheels of the robot.

In URBI, all the motor's speed and the sensor's value in a robot are associated with variables. You can set the motor's speed or get the sensor's value by assigning or reading the values of the corresponding variables.

In the default server layout for the TriBot model, the left wheel is assigned to variable wheelL and the right wheel is assigned to wheelR [1]. The values of these variables control the corresponding wheel speed. First put the TriBot upside-down to avoid any accident, then you can move the left wheel just doing:

  wheelL.speed = 50;

Don't omit the semicolon at the end of the line, or the command will not be executed. You can also move the right wheel (a negative value is a move backward) :

  wheelR.speed = -50;

A group is also defined so that you can give orders to several motors at the same time. In our case, the group wheels contains both robot wheels. Setting wheels to a value will set both wheels to this value :

  wheels.speed = 0;

will stop both wheels.

The third motor of the TriBot is associated with the claw variable.



[1] To be precise, sensors and motors are associated with objects. The left motor is associated with the wheelL object and the left motor speed is associated with the wheelL.speed attribute of this object.