3.18

## Begin Robotics

Skip to 0 minutes and 1 secondOK. It's time for another exercise. This one's a bit different. Rather than commanding to the robot to do something at one instance in reaction to it sensors, you're going to command the robot to do something for a particular period of time, or to travel a particular distance, or turn through a particular angle.

Skip to 0 minutes and 22 secondsSo here's the web page. Now if I scroll down so that we can see all the different bits at the bottom, what you've got is a robot in an arena, and by default there is this rectangular path. What you start to do is to experiment. So for instance, what happens if I want the robot to travel at speed eight and go forward 100 times? That's what you do. And you can change the speed to say travel speed three and turn five times, and it will do that. So you start off by doing some experimentation to work out what speed and for how long will it take to get the robot from the start of the rectangle across to there.

Skip to 1 minute and 8 secondsAnd then do some similar experimentation to get it to turn through 90 degrees. And how to travel down the side of the rectangle. Eventually working out how you go from the start of the rectangle, all the way around, back to the beginning again. OK. Once you've worked out some of these, rather than interactively putting a number in, pressing forward, or pressing turn right, you can put in a string like this at the bottom. So if I reset the robot to the beginning, and then look at the string which says forward at speed two for 100 times, turn right, speed two for 10, forward, two for 10, turn left, three for 9. And then if I press Obey, it does that.

Skip to 1 minute and 50 secondsGoing forward, turning right, and not going around back there. So it's not a particularly useful command, but that's what you can do. So after some experimentation, you should be able to have a nice string here which gets the robot to go all the way around the rectangle. Having done that, you can have a racetrack. Put the robot to the beginning here, work out again the commands to move the robot around the racetrack until he gets to the green area in the middle. And having done that, and it works, we'll introduce what we call a hilled track. The key point about this is that there are areas here where the robot is going uphill.

Skip to 2 minutes and 33 secondsLiterally it's a bit Escher-like rather than a real hill, in that whichever direction you're going, you go uphill. This darker area here is a downhill one. And you will find that the commands that got you around the racetrack when it was flat won't work when you've got these hills. Unless you put speed control in. OK. So work out the commands to go around with flat track, with the hills. And then see, with speed control, if you can find one command that will move you all the way around, whether you've got a flat track or the hill track. Optional, if you want to, you can change.

Skip to 3 minutes and 14 secondsInstead of commanding the robot to move a speed for a certain number of times, specify instead travel for a particular distance. When it's turning, turning through so many degrees. And see again if you can work out how to get the robot around the track. Have fun.

# Command a robot to do specific actions

In this first exercise of Week 3, you will have the chance to command a robot to do specific actions and for a certain number of times.

You need to work out how to move the robot around the rectangle. Before you start experimenting with the simulation, watch Richard demonstrate how the exercise works.

Ready? Move on to the next Step to open up the exercise.