Adding a vertical ultrasonic sensor to ClareBot allows the robot to go around an arena without touching the walls. [Video Big, Small].
The use of only one fixed sensor makes this robot easier to program than most wall followers, and this "Reminder" can be a useful follow-up to Challenge 52. The robot in the videos uses the smaller NXT 2.0 wheels, but this robot has also had successful runs using the larger NXT 1.0 wheels. Brief mentor notes are available in Word 2003 and pdf formats. Let's start building the Robot...
Click on pictures to enlarge.
One of the things we would like our robot be able to do is to run around an Arena without having to bump into the Arena walls. Let us teach our Robot to avoid the arena walls.
Suppose we have an Arena like this:
Don't worry if your Arena is different from the photograph above. The walls of your arena could be made from cardboard, piles of books, boxes, or anything your teacher suggests. It is a good idea to avoid soft walls like cushions or cloth, as the ultrasonic sensor does not work well with these materials. We found that ClareBot worked best if the walls were taller than 12 centimetres (about 5 inches).
We would like our robot to be able to tell if it is too close to the wall, or too far away from the wall, like this:- [Video Big Small]
1A) If our robot is too close to the wall, we would like it to move away. [Video Big Small]
1B) How do we tell our Robot to turn away by using the Sonar Sensor? [Video Big Small]
First we need a switch. This will be a touch sensor switch when we first choose it. Change it to an ultrasonic (sonar) sensor.
If you not sure which part of the ultrasonic switch is used when telling your robot what to do when it is too "NEAR" the wall, and which part of the switch is used when the robot is too "FAR AWAY", here is a way to remember:-
Now let us tell our robot to move away from the wall when it is too NEAR the wall.
Add an ultrasonic (sonar) switch.
A distance of 20 centimetres is fine for our testing.
Add two motors.
We can make the Robot's right-hand motor (motor A) go forwards 1/4 of a rotation at a speed of 75%, see below.
We can stop the Robot's left-hand motor (motor C); see below.
These commands should cause our robot to swing forwards away from the wall.
1C) What does our Robot do when we try out the 1B instructions? [Video Big Small]
2A) If our robot is too far away from the wall, we would like it to turn towards the wall. [Video Big Small]
2B) How do we tell our Robot to turn towards the wall by using the Sonar Sensor? [Video Big Small]
This will tell the robot's motor nearest the wall (motor A) to go backwards, turning the robot towards the wall.
This will tell the robot's motor furthest away from the wall (motor C) to go forwards, turning the robot towards the wall.
2C) What does our Robot do when we try out the 2B instructions? [Video Big Small]
3A) We want our Robot to keep following along the wall, like this: [Video Big Small]
3B) How do we add a loop to make our Robot keep following the wall? [Video Big Small]
3C) What does our Robot do when we try out the 3B instructions? [Video Big Small]
Not every maze. This addition to ClareBot is good for arenas, and can also solve mazes that do not have very tight right turns (but almost all mazes DO have tight right turns!) Tight right turns usually result in failure, making this robot not suitable for general maze solving. You can see this limitation here. [Video Big Small]. This ClareBot modification is suitable for a first attempt at wall following because it only uses one sensor. Robots that are used to solve mazes almost always use more than one sensor. Can you think of a way to add another sensor to ClareBot to solve all kinds of mazes? You could get a hint by looking at Grade 8 student Yaya Lu's first wall follower at the bottom of this web page.
www.DrGraeme.net - Adding an Ultrasonic (Sonar) Wall-Following Sensor to ClareBot - Copyright Dr. Graeme Faulkner 2011