The sensing blocks on the Robobo base are the following:
All of them are related to information that Robobo can capture through the sensors located in the base. It is important to use the monitoring window to check the values returned by these sensors in real time in each specific environment.
Reset sensor _
- Function: restarts the sensor selected in the drop-down field. This block affects the smartphone sensors too, so it will be described in that section again.
- sensor selection:
- all: resets all sensors.
- IR: resets the value of the infrared sensors to 0.
- acceleration: resets the value of the accelerometer to 0 in the three axes (x, y, z).
- brightness: resets the ambient light sensor value to 0.
- claps: resets the clap counter to 0.
- face: resets the distance to face sensor to 0 and the position sensor (x, y) to (0,0).
- fling: resets the fling angle sensor to 0.
- orientation: resets the orientation angles of the smartphone (yaw, pitch, roll) to 0.
- tap: resets the contact zone sensor on the screen to NONE.
This block is useful for those sensors that store the last read value or that store a value continuously, for example, the clap sensor or the distance to face sensor. The following example shows a program that reads the number of claps detected and, while they are less than 5, it turns on the LEDs of the base in blue. As soon as they are 5 or more, it turns on the LEDs in red and wait for 3 seconds. For the program to continue indefinitely, it is necessary to reset the value of the clap sensor:
IR value at sensor _
- Function: returns the value measured by the infrared sensor (IR) selected in the drop-down field.
- RangE: from 0 to inf (without limit). The larger the value, the smaller the distance at which the detected object is located. Therefore, this value is a kind of intensity of reflected energy, so if it is 0 it means that no object is detected.
- WARNING: The operation of the infrared sensors depends on the ambient light level and the material of the object to be detected. As a consequence, the value returned by this sensor must be calibrated in each particular environment.
- SENSOR SELECTION:
- There are 8 infrared sensors in the Robobo base named as shown in the previous image. The Front-C, Front-LL, Front-RR and Back-C sensors are oriented parallel to the ground, that is, they detect the objects in front of them, but they do not detect possible holes in the ground. On the other hand, Front-L, Front-R, Back-L and Back-R sensors have an orientation of 45º with respect to the ground in order to detect these holes, and thus avoid falls from height, for example. This orientation influences the use of a sensor or another to detect obstacles.
The following program makes Robobo to move forward until it encounters a nearby obstacle in the central front sensor (the value of 200 must be adjusted to the light level and the type of object). When that happens, it moves backwards for 1 second to separate from the obstacle, then rotates 180º and, finally, it moves in the opposite direction during 2 seconds:
Base Battery Level
- Function: returns the battery level of Robobo base.
- RangE: from 0 to 100, so that the higher the value, the higher the base battery level.
Below is a typical program that could be in permanent execution, controlling the battery level every 5 minutes (300 seconds), and showing a warning when that level falls below a certain threshold. In this case, the warning consists in turning on the red LEDs in an intermittent way:
_ wheel position
- FuncTION: returns the position of the motor selected in the drop-down field. This position corresponds to the degrees of rotation of the wheel from its restart.
- RangE: from -inf to inf (no limit). It must be taken into account that a full turn of the wheel is 360 degrees. If the wheel rotates backward, the degrees of rotation decrease, and may be negative.
- WHEEL SELECTION: right or left wheel motor can be selected
With this block we can know the approximate distance Robobo travels. In this example, this block is used to make the robot to stop when the right wheel has made 2 full turns (720 degrees). If we know the length of the circumference of the wheel, we can easily determine the distance traveled:
- Function: returns the PAN motor position. It corresponds to the degrees of rotation of the motor since its restart.
- RANGE: from 27 to 339, according to the allowed angles for this engine, being 180 the start value (as shown in the image). Values less than 180 indicate that the PAN is turned to the left, while values greater than 180 indicate that it is to the right.
- example of operation:
In this example, the PAN motor is moved to a random value within its operating range, and then the LEDs on the base side corresponding to the rotation made are turned on. We can see, therefore, that this block allows us to know the orientation of the smartphone with respect to the base at any time:
- Function: returns the position of the TILT motor. This position corresponds to the degrees of rotation of the motor since its restart.
- range: from 26 to 109, according to the values allowed for this engine, 90 being the start value (as shown in the image). Values less than 90 indicate that the smartphone holder is rotated backward, while values greater than 90 indicate that it is forward.
- example of operation:
In this example, the TILT motor is moved to a random value within its operating range and then the front or rear LEDs of the base are lit according to the TILT angle. We can see, therefore, that this block allows us to know the orientation of the smartphone with respect to the base at any time: