Introduction
We need to patrol the planet to keep it safe, but don't have time to do it ourselves. Learn how to get your robot to steer itself automatically!
-
-
Autonomous robots are very important in advanced factories!
-
Watch the video to see some of Amazon's autonomous transport robots moving products around the warehouse.
-
Think how many people would be required to do the job of the robots!
-
-
-
We're going to make our own autonomous robot to patrol the outside of the planet.
-
Assemble your robot like the picture!
-
You will need the line sensor module for this lesson. For best results, mount your line sensor underneath your junior main board as shown
-
Just connect the left sensor to A for now.
-
-
-
How does the line sensor work? Let's write a test program to find out.
-
Build the test program in the picture. Can you guess what it will do?
-
Program your robot and place it on the activity mat, outside the planet - the motor should be off.
-
Then, try moving it onto the planet - the motor should start turning!
-
-
-
Turn the robot over and look at the bottom of the line sensor. You should see 3 LEDs.
-
The centre LED is an infrared emitter - just like on your TV remote control! It shines infrared light downwards all the time.
-
The two outer LEDs are infrared receivers - they can sense infrared light.
-
When the robot is on a black surface, infrared light is not reflected and so the receivers give a LO signal.
-
On a white surface, the light is reflected and so the receivers give a HI signal.
-
Using the signal from the sensors (HI or LO), we can detect what colour surface to robot is on!
-
-
-
Let's use the line sensor to stop the robot from driving off the planet.
-
Don't forget - the sensor is HI on white backgrounds, and LO on black backgrounds.
-
Put the code blocks in the picture into a program that makes the robot:
-
Drive forward
-
Stop IF it drives off the planet (when the background is black)
-
-
-
Now we have everything we need to drive around the edge of the planet automatically!
-
To do this, your program needs to:
-
Drive forwards
-
Check the sensor
-
If the sensor is LO, we are about to drive off the planet! Turn slightly towards the middle of the planet and then go forwards again.
-
Your robot should drive around the edge of the planet, without getting lost. There is a hint of the blocks you need in the picture if you need help!
-
Try and make your robot drive around the planet as smoothly as you can.
-
-
-
Currently, the robot tries to stay on the white and avoid the black.
-
Can you change the code so the robot orbits the planet by staying on the black, and turning away from the white?
-
Hint: instead of normally going forwards, you will need to normally be turning towards the centre of the planet.
-