Skip to 0 minutes and 1 secondSo let's see how I got on trying to do the exercises in the second week.
Skip to 0 minutes and 11 secondsThis is the web page, and I've set the speeds up. So the when no wall is seen, the robot will go forward, I've ticked the reverse left motor option. When a wall is detected on the left, the left motor goes forward, the right motor stops, and the robot will turn away from it. And then the opposite, and so forth. So if I press start we see the robot's doing fine. That is, until it hits the wall. When it can see the wall, it goes back, then it can't see the wall so it goes forward, which is particularly dumb. So what you actually need to do, is that when you do see a wall on both sides, go back, but turn.
Skip to 0 minutes and 46 secondsIf I turn that minus 4 to minus 2, you see it's now turned away quite happily. And it goes along, and when it detects a wall here, it turns. And it turns. Also works with a complex environment, like so. Mind you, it has got stuck in the corner again, it's sort of turning one way then the other way. I'll have to give it a little nudge. But then it's okay. So it is working all right. I'm going to scroll up so I can see the track controls, and I'm going to put track on. And I'm going to go racing. Does it now work? It sees-- oh, and it turns, yes.
Skip to 1 minute and 27 secondsIt's turning the right way, so it's going around the track. And it's going to turn again, yeah, who's a good Eric. Hey, presto. That's worked quite nicely. Okay. How about doing a return race. Is it going to work? So let's go racing, and-- no, it's turning the wrong way. That's because it's turning right, going this way. But it's got to turn left that way. So I need to change the speeds for when it sees an object on both sides. Now when I go racing again from the start, you'll see, it's going there, round, and-- yes. Turns the right way. So with very simple commands, the robot can navigate a race, though it does need to know which way it's going.
Skip to 2 minutes and 28 secondsAnd here is the second exercise. Can we steer to the lights. Well, again, I've set up the speeds so that, when no light is seen, the robot goes forward. When the light is just seen on the left, it turns towards it. So the left motor goes a bit slower, the right motor stays at the same speed, and it will turn. When it gets closer, it gets a bit slower still. So if I press start, you'll see that it works. Yep. Sees it, turns. Sees it, turns, and now it gets slower. And it finds it. It works quite nicely. Stop it, put it back to initial position with the wider beams, you'll find it works just as well.
Skip to 3 minutes and 16 secondsGoes straight towards it, rather than turning towards it. So that's fine. If I want the robot to steer towards the light, then veer away, then I want to change things when the light is much closer. So, if instead, of turning towards it, we turn away.
Skip to 3 minutes and 42 secondsPut the robot back in the initial position, and press start. We will see. Comes along, sees the robot, turns towards it, happy. And, anyway, it gets very close, it zooms that way. Okay. So it does work.
What you should expect to see in the simulations
If, for whatever reason, you aren’t able to try out these exercises for yourself, Richard has recorded this brief video to show you what to expect. He demonstrates what happens when he manoeuvred the mobile robot around a race track and in an arena to avoid various obstacles.