Vacuum Cleaner (b). Cleaning the house
- Carlos Caminero
- 17 nov 2020
- 2 Min. de lectura
Actualizado: 21 nov 2020
In this second part of the proyect, we have to clean the house, using an algorithm without global navigation, that is, the robot does not know the environment (it has not a map), it was only followed by its senses.
For that, we have created another and much better finite states machine. Now, the states are the following:
Spiral state
Wall state -> follow wall
Bump_spin, same as in the previous part.
GO_FORWARD (different cases in wall state and bump_spin)
GO_BACKWARD
TURN_STATE
And this is how I have communicated the states in summary form:
timer 1: 550 s
timer 2: 150 s

Creative process:
- SPIRAL STATE. In this part, the robot begins with linear velocity = 1.4 and angular velocity = 4. It moves circularly decreasing the angle of rotation for each iteration. When the robot detects and obstacle with the laser or the bumper, it stops and changes the state to WALL_STATE
- WALL STATE. It will be following the wall of his right hand. For that, we have used the maze algorithm, alias right hand algorithm. It is used for solve mazes, so in this situations with the vacuum cleaner robot is the best option. We analise many situations with laser: if we have a wall in front of the robot, we turn left; if we have a wall in the right hand we continue forward, etc...
I have used some strategies in the case of the laser does not work well, using the bumper and changing in the GO_FORWARD, GO_BACKWARD and TURN substates to get out of the trouble. When the timer 1 has finalized (550 seconds), we change to Bump Spin.
- BUMP SPIN STATE. Really it is guided by a boolean variable named is_bumpspin, where depending on the value of this variable, the GO_FORWARD, GO_BACKWARD and TURN states are different and they behave similar to "Vaccum Cleaner (a)" proyect. When the timer 2 (150 seconds) has expired, it changes to WALL_STATE and thus, always, in an infinite loop.
In the first version, I had not used the BUMP_SPIN state in my program. I got 72 % of the house cleaned. It is very well, but there is a problem. Imagine that instead of 15 minutes it is 30 minutes. It would always carry out the same route and it would keep the same holes in the rooms without cleaning.
For that, I included the BUMP SPIN state. In this case, 15 minutes are few, but thanks to the timers, with a longer time (with more than 15 minutes) it would clean new areas thanks to the BUMP SPIN state that it does not follow walls
This is the final version, if we had had more time to clean, probably, we had got more than 80 %. In the minute 9.40 begins the bump spin state and as we can see, it cleans areas that would be unreachable if we only followed the walls. It depends of random decisions.
Comments