Tip:
Highlight text to annotate it
X
At the end of our last tutorial we wanted our Robot to turn in this direction, so...
so it could find the edge of the black line
But it turned in the opposite direction!
Oh dear!
This is easily corrected.
We change the zero motor speed to fifty, and...
the fifty motor speed to zero.
This will mean our Robot will spin in the opposite direction...
It will now spin from white towards the black edge of the line.
In the lower command line of the Switch, we want to put in a command that will cause the Robot to spin from black to white
This is the opposite to the command in the top line of the switch.
Left-click on the "Move Tank" command and drag it up to the lower command line of the switch
Change the "On for Rotations" to "On"
Change the motor commands so that they are the opposite of the motor speeds in the top line of the switch...
Zero speed on the left motor, and fifty on the right motor speed.
This will mean when the Robot sees white under its Color Sensor, it curves right from the white towards the edge of the black line
This will mean when the Robot sees black under its Color Sensor, it curves left from the black towards the edge of the black line
Let download this to test our Robot commands.
We have one more correction to make...
See the exclamation mark above the "3" in the switch?
This the EV3 telling us that we have told the switch that the color sensor is in sensor slot 3, but that this is wrong!
The EV3 is right. YayaBot has the Color Sensor plugged in to slot 4 (not slot 3).
So let us correct that. Thank you EV3!
Since the EV3 no longer protests, we will download our program commands into YayaBot.
Will YayaBot be able to follow along this black/white edge?
Ah! A good start - YayaBot follows the edge quite well...
But what happens when YayaBot tries to go around a curve - this is more difficult...
Let us try YayaBot on the Australian RoboCup Rescue mat.
Not so good - YayaBot leaves the line...
But we might be able to teach YayaBot better Commands
First let us check the color sensor light values.
I found the reading was 11 when the color sensor was above black, and...
and the reading was 78 when the color sensor was above white, so...
(11+78)/2 = 89/2 = 44.5 , set the value to either 45 or 44.
We will also give YayaBot a bit more power to turn curves by changing the "zero" motor commands to minus fifteen percent.
This will give YayaBot a bit of a "kickback" when going around corners.
Let us download these altered commands into YayaBot.
Good start...
Went around the gentle curve quite nicely
The next curves are the most difficult in the RoboCup mat
Oh! Very good!
YayaBot's shape is good for a SUMO Robot, but is less ideal for a Rescue Robot, so it is doing exceptionally well...
YayaBot is an edge-following Robot. Specialist line-following Robots using two color sensors can be slightly faster, but...
but YayaBot is doing marvellously well for a single-color-sensor Robot; I'm very pleased!