RUNAWAY ROBOT CHALLENGE
Make your robot move forward slowly. When you move in front of it, it should turn a half turn away from you and keep moving forward (away from you). Repeat these actions for 10 seconds.
FIND & POINT CHALLENGE
Make your robot turn on the spot slowly. When it sees an object close to it e.g. a coke can, it should stop. See if you can make the robot point straight at the middle of the object when it stops.
EDGE FOLLOWER CHALLENGE #1
Find or make a black line on a white background. Determine a good number to use for the difference between black and white. We recommend a number half way between the black and white readings.
Repeat the following sequence in a new program (put it in a loop):
move the B wheel, power 60, on
wait until the Color Sensor finds light coloured background
stop the B wheel
move the C wheel, power 60, on
wait until the Color Sensor finds dark coloured line
stop the C wheel
Download your program. Put your robot down with the light sensor on a black line and run the program.
Repeat the following sequence in a new program (put it in a loop):
move the B wheel, power 60, on
wait until the Color Sensor finds light coloured background
stop the B wheel
move the C wheel, power 60, on
wait until the Color Sensor finds dark coloured line
stop the C wheel
Download your program. Put your robot down with the light sensor on a black line and run the program.
RACING ROBOT
Racing Robot needs to:
- walk to the starting line (a black stripe) steps 1 & 2 below
- wait for the dark grey Enter button to be pressed step 3 below
- race off to the finish line (another black stripe) step 4 below
- beep and stop. step 5 below
Start by writing a robot walk program or opening the one you made in the Robot Walk Loop. Don't make the steps too big – you'll see why shortly. Try 80 degrees.
Select the Loop block. It is probably showing Count 4. The robot needs to walk until it senses the start line, so set the Loop control to Color Sensor > Reflected Light Intensity Set the Loop to finish when the light sensor sees black.
Select the Loop block. It is probably showing Count 4. The robot needs to walk until it senses the start line, so set the Loop control to Color Sensor > Reflected Light Intensity Set the Loop to finish when the light sensor sees black.
The robot should now walk to the Start line and stop at least some of the time.
Put a Wait block after the walk loop. Control this loop by Brick Buttons > Compare.
Use the default settings: Button ID [2] (the dark grey middle button) and State 1 (pressed). The program will just wait for the button press before continuing.
The next action the program needs to perform is to race to the finish line.
Add another Loop to your program. Put an unlimited Move Tank block inside the loop, and finish the loop when the robot sees black. This is a race, so set the Power to 100.
Finish the program with a Beep and stop the wheels.
This program you have written probably has at least one and maybe two serious problems. See if you can work out what the problems are. The answer is at the bottom of the page.
Put a Wait block after the walk loop. Control this loop by Brick Buttons > Compare.
Use the default settings: Button ID [2] (the dark grey middle button) and State 1 (pressed). The program will just wait for the button press before continuing.
The next action the program needs to perform is to race to the finish line.
Add another Loop to your program. Put an unlimited Move Tank block inside the loop, and finish the loop when the robot sees black. This is a race, so set the Power to 100.
Finish the program with a Beep and stop the wheels.
This program you have written probably has at least one and maybe two serious problems. See if you can work out what the problems are. The answer is at the bottom of the page.
Fixing problem 1
Make the robot move past the start line before it starts looking for the finish line. There are many ways to do this. See if you can get one working.
Fixing problem 2
Drag a Switch block and put it between the robot's 2 steps. A Switch gives the program a choice of 2 paths to follow.
Set this Switch block to be controlled by the Color Sensor > Reflected Light. Set it the light level to the same as the one you have chosen to finish your walk loop.
The top path (sequence beam) is for the comparison being true (light level < your setting), so the top path is for what you want to happen if the robot is on black after the first step in its loop. (Nothing. It has found the start line and is ready to race.)
The bottom path is for a robot which is still on white after its first step. You want it to take the second step in the loop.
Drag the “second step” blocks to the bottom path of the Switch.
The robot is less likely to miss seeing (sensing) the start line now.
Make the robot move past the start line before it starts looking for the finish line. There are many ways to do this. See if you can get one working.
Fixing problem 2
Drag a Switch block and put it between the robot's 2 steps. A Switch gives the program a choice of 2 paths to follow.
Set this Switch block to be controlled by the Color Sensor > Reflected Light. Set it the light level to the same as the one you have chosen to finish your walk loop.
The top path (sequence beam) is for the comparison being true (light level < your setting), so the top path is for what you want to happen if the robot is on black after the first step in its loop. (Nothing. It has found the start line and is ready to race.)
The bottom path is for a robot which is still on white after its first step. You want it to take the second step in the loop.
Drag the “second step” blocks to the bottom path of the Switch.
The robot is less likely to miss seeing (sensing) the start line now.
Finish the Racing Robot challenge by
- making sure your robot takes steps small enough that it NEVER misses the start line
- putting a text message on the screen saying “Enter to Start” so that other people will know what the robot is waiting for on the starting line.
Take this message off the screen when the race has started. You could replace it with one which says “Racing now”
YO-YO Robot
This program moves the robot forward a little if there is nothing in front of it, and backwards if there is something in front of it.
Drag a Switch block to a new program.
Set it to Ultrasonic (distance) sensor, distance less than 30cm.
You will see there are 2 paths (MINDSTORMS calls them sequence beams) in the Switch block.
Your program will choose which one to follow depending on the Distance setting on the Switch block and the information received by the sensor.
In this case, if the robot is less than 30cm from an object, it will follow the top sequence beam. Otherwise it will follow the lower sequence beam.
Drag a Move Tank block into the top sequence beam. Set it to move backwards 3 rotations. (If the robot is closer than 30cm to an object, it will move backwards.)
Drag a Move Tank block into the lower sequence beam. Set it to move forward 1 rotation. (If the robot is further than 30 cm away from an object, it will move forward 1 rotation.)
There is one further step needed. The ultrasonic sensor is likely to see your hand as a close object when you push the run button.
Drag a Wait block to the beginning of your program (before the Switch block). Set the time for long enough to get your hand away.
Download. Put the robot near (and pointing towards) a wall and run the program. If your robot is very close to the wall, it should move backwards. Otherwise it will move forward. Shift the robot and run the program again, and again, and again . . .
The Switch block can be thought of as an 'if ' then an 'else' :
If the robot is closer than 30 cm it will go back, or else it will go forwards.
Put this program in a loop so that the robot moves backwards and forwards forever.
Drag a Switch block to a new program.
Set it to Ultrasonic (distance) sensor, distance less than 30cm.
You will see there are 2 paths (MINDSTORMS calls them sequence beams) in the Switch block.
Your program will choose which one to follow depending on the Distance setting on the Switch block and the information received by the sensor.
In this case, if the robot is less than 30cm from an object, it will follow the top sequence beam. Otherwise it will follow the lower sequence beam.
Drag a Move Tank block into the top sequence beam. Set it to move backwards 3 rotations. (If the robot is closer than 30cm to an object, it will move backwards.)
Drag a Move Tank block into the lower sequence beam. Set it to move forward 1 rotation. (If the robot is further than 30 cm away from an object, it will move forward 1 rotation.)
There is one further step needed. The ultrasonic sensor is likely to see your hand as a close object when you push the run button.
Drag a Wait block to the beginning of your program (before the Switch block). Set the time for long enough to get your hand away.
Download. Put the robot near (and pointing towards) a wall and run the program. If your robot is very close to the wall, it should move backwards. Otherwise it will move forward. Shift the robot and run the program again, and again, and again . . .
The Switch block can be thought of as an 'if ' then an 'else' :
If the robot is closer than 30 cm it will go back, or else it will go forwards.
Put this program in a loop so that the robot moves backwards and forwards forever.
EDGE FOLLOWER CHALLENGE #2
You can use the Switch block in a loop to make a your robot follow a black line. The process can be described in word like this:
Do this forever:
If the sensor is on black, keep turning to the right.
If the sensor is on white, keep turning to the left.
Write a program which uses a Switch block to make the robot follow a black line.
The following tips may be helpful.
Do this forever:
If the sensor is on black, keep turning to the right.
If the sensor is on white, keep turning to the left.
Write a program which uses a Switch block to make the robot follow a black line.
The following tips may be helpful.
- The safest way is to use just use one wheel when making each turn.
- You will need to stop the other wheel first or it will keep on moving.
- Lower power settings will give you a more reliable line follower. Fast robots make mistakes by overshooting the line, especially on curves. Try Power of 60.
Answer:
The robot is still sitting on the black start line when it starts to race. It is looking for a black finish line and thinks it has found it straight away.
The robot doesn't always find the start line. It takes two steps inside the loop before each check to see if it is on black, and often this is enough to go past the start line (a false start).
The robot is still sitting on the black start line when it starts to race. It is looking for a black finish line and thinks it has found it straight away.
The robot doesn't always find the start line. It takes two steps inside the loop before each check to see if it is on black, and often this is enough to go past the start line (a false start).