OK. I will now show you my answers to the exercises this week.
So this is the robot for following walls, and I set things up. Basically if it doesn’t see a wall, it goes forward. If it just sees one on the left, he turns towards it. So the left motor is less than the right motor. If it’s closer, then you move to turn away slightly. So the left motor should be 4, the right motor, 3. And then the opposite on the right. When wall is close to both sensors, and you want to back off, but you also want to turn, so let’s press start. And we can see the robot is quite happily moving along.
And then we’ll see when he gets to the end, it should reverse, and turn, which it does. It’s turning, and so forth. Following the wall, if I move into this– out into the open, that’s fine. So it’s working quite nicely. Now if I put the maze on, we’ve got a problem, as we shall see, because as the robot should turn quite happily, it’s going fine. But because we’re saying go forward when he doesn’t see anything, it will just carry on forward. Whereas we wanted it to turn into the gap. So we need to do something about turning into gaps.
Now we’re turning in this direction, or in this point here, so we need to, sort of, turn in the same way, when you don’t see a wall. So what I need to do is to slow down the left motor, so that– we’ll have to wait for it to get there– speed it up a bit.
Now we should see, as it comes along, it will turn into the gap, which it does, and round. And then it’ll carry around here, and get back to there. So that’s how I got my robot to navigate the maze quite so. I wonder if you were able to do it a bit faster.
OK. Now let’s move on to the Braitenberg-type robot. I’ve set it up for the first task, the passive seeker. So when the robot can’t see anything, the LM and RM motors are– our neurons are set to before, so the robot will move forward. Notice I have reversed the left motor connection. But when you see something on the left, you want to slow down, and turn towards it. So we got a minus three in there. And we shall see the robot coming along like that. Sees, turns. Gets closer, and then it slows down at the end, and it’s got there.
If I put it back to the initial position and have wider beams, then as soon as it detects it, you’ll find it turning, but going slower, which is what you want for the passive seeker.
Now for the active seeker, I’m now using the neurons that go to the opposite side. So that when, for instance, you see something on the right, then that would increase the speed of the motor. So if we run that, we see it’s going on quite happily at speed three. And it sees, and it turns, and it accelerates towards it, which is exactly what we wanted.
And for the active phobe, I’ve swapped over the LL and LR and the RL and RR neuron values, so that when the robot starts to see it, it then turns the motor with the wheel, and it will move away from it. So let’s watch that. Can’t see anything. Moves closely, and as soon as it sees it, it turns away. OK. And now for the line following mode, I’ve got LM and RM going forward, and the LL and RR going backwards. So if I start this, find the robot going forward, sees the line, turns towards it, and now follows it. So quite easily, the Braitenberg vehicle will follow lines, as well as steering towards or away from lights.
So did you do it that way? Or did you do it slightly differently? OK?