Robots explore their environment, but they must be careful. They may find obstacles in their way or reach the edge of a precipice. If they learn to detect dangers and avoid them they won’t be damaged.
In this tutorial, you will learn how to detect obstacles and make Robobo stop before crashing. You will also learn how to turn on/off the LEDs and change their color like a light signal.
The challenge is the creation of an Anti-Shock Robobo!
Before starting this challenge, we recommend you to do the Tutorial #1 and to have the ScratchX programming manual at hand:
challenge: anti-shock ROBOBO
Creating a program that makes Robobo go straight until it detects an obstacle.
Through the front infrared sensors, Robobo will detect the obstacle and, as it advances, it will change the color of the LEDs to indicate the distance to the obstacle (green if far away, yellow at medium distance, and red when near). In addition, when it is close to the obstacle, it will stop to avoid the collision.
If you don’t know how to get started, here’s a little help, cheer up!
A possible solution to this challenge is the following, although there are many others. Which one is yours?
When you have completed the “Anti-shock Robobo” challenge, we propose you a new one that uses the same sensors, but in a slightly different way, shall we try?
Put Robobo on a table and try to prevent it from falling to the ground. Perform this challenge with care, if Robobo falls it can break. Use a slow speed for the tests of your program and stay alert in case you have to catch it to prevent it from falling while you debug your program.
Note that the infrared sensors Front-L, Front-R, Back-R and Back-L are inclined towards the floor, so these are the ones to use in this new challenge.