Skip main navigation

Follow walls/maze

Watch how to use a simulation to define motor speeds to follow walls/maze, before having a try yourself.
It’s time for another exercise. This one is about getting your robot to follow a wall and then go around a maze.
So here’s the web page. And we can see our robot as normal. And if I scroll down, we can see all the controls.
You basically have to specify the speeds of the motors under different conditions, like when there is no wall seen, when there is a wall that you could just see on the left, or when there’s a wall that’s much closer on the left or similarly on the right, or even when a wall is being seen by both sensors. So as ever, you type in these left-right speed pairs. And you can use the reverse left motor option, if you want to. Once you’ve got the robot to follow the wall going along here and then going down, you can untick the option. And then you’ve got a maze.
And now you’ve got to define the speed so that the robot will come around here, go through the gap, and turn, go through the gaps, and so forth. I’ll show you what I mean by that. I’ve now typed in the speeds, but I’ve hidden them so you can’t see them. And I set the robot to go. And as you can see, it’s quite nicely following the wall. And then when it gets to the end, it should turn, which it does. Now it’s coming along quite happily.
And it see a gap. And it turns into it.
So you need to emulate this behaviour.
Probably find it’s best if the robots go a bit slow like this. Anyway, a little task to do. Enjoy.
In the exercise in the next step you will have the chance to drive your robot around a maze. Before you get started, take a look at this video in which Richard shows you how to define the speed of the motors so that the robot follows walls.
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