Skip main navigation

Command a robot to do specific actions

Watch how you can command a robot to do specific actions in a simulation developed by Professor Richard Mitchell.
1.1
OK. 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.
22.2
So 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.
67.7
And 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.
109.9
Going 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.
152.8
Literally 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.
193.9
Instead 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.

In this first exercise of Week 3, you will have the chance to command a robot to do some specific actions 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.

This article is from the free online

Begin Robotics

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education