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.
read ir _ sensor value
- FUNCTION: it 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, Back-L and Back-R 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 and Back-C 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 move forward until it encounters a nearby obstacle in the central front sensor (the value of 100 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:
Read _ wheel position
- FUNCTION: it 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 backwards, 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 travelled:
REad _ wheel speed
- Function: it returns the speed of the selected wheel at each instant of time.
- RangE: From -100 to 100, according to the power that can be assigned to each wheel in the blocks of movement.
- WHEEL SELECTION: right or left wheel motor can be selected.
The following program makes Robobo advance in a straight line with a speed that increases by 10 from 20 to 50 (4 times). At each step of the loop, it says the real speed reached by the wheel (only the left wheel is used as both use the same value).
reset wheel encoders
- function: it sets the wheel position and speed sensor to 0.
The next program makes Robobo run in a straight line until the wheels have made 5 full turns. For this, the RESET WHEEL ENCODERS block is used within the loop, so that it can be used as a 360-degree comparison value. If this sensor is not reset, the value of the rotated angle will not stop growing:
read pan position
- function: it returns the PAN motor position. It corresponds to the degrees of rotation of the motor since its restart.
- RANGE: from -160 to 160, being 0 the start value (as shown in the image). Negative values indicate that the PAN is turned to the left while positive values indicate that it is turned to the right.
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:
read TILT position
- function: it 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 backwards, while values greater than 90 indicate that it is forward.
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:
read base battery level
- function: it returns the battery level of Robobo base.
- Range: from 0 to 100, so that the higher the value, the higher the base battery level.
- It has two base/phone options, since this block also returns the smartphone’s battery level. In this section we are focusing on the sensors of the base, so the value should be base.
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: