Skip to content
English

Sensors

Sensors tell your robot about the world. Every sensor is used in the same way:

  1. Get it by its name with robot.getDevice().
  2. Enable it with enable(timeStep). Until then, it gives no values.
  3. Read it inside the main loop. Values are updated after each robot.step().

Like real sensors, they have noise: the same reading can change a little from one step to the next. Organizers do not change the noise for the competition, so make your program robust to it, for example by comparing several readings.

The pages below use the sensors of the starter robot.