Contact FutureLearn for Support
Skip main navigation
We use cookies to give you a better experience, if that’s ok you can close this message and carry on browsing. For more info read our cookies policy.
We use cookies to give you a better experience. Carry on browsing if you're happy with this, or read our cookies policy for more information.

Skip to 0 minutes and 1 secondOK, this video explains how we do motor control. And we've seen that friction and whether you're going up or down hill affects the motor speed. So how do we control it? Well, we go back to the ideas that come from Kybernetes, the steersman. Now the steersman has a boat, which is affected by wind and tides. And he wants to follow a particular course, which he does by looking to see which course he's following, and if it's not right, he does some suitable action. So if he's going to the left, he steers to the right. Now those ideas apply to human control of a robot.

Skip to 0 minutes and 37 secondsA robot is affected by friction and hills, and what the human needs to do is to measure the speed. And if it's too fast, slow the robot. If it's too slow, speed it up. That is, we need to increase or decrease the voltage which we apply to the motor, which is the PWM signal. This we can do on our web page. This is the web page. And this is the speed profile we see, when we had no control. Now, I've got user control. When I restart the run, I'm going to see a speedometer, which is going to tell me if I'm going too fast or slow.

Skip to 1 minute and 12 secondsAnd then I use the up and down keys, which will allow me to speed up or slow down. So, off we go. Oh, too slow. Hit u to get up to speed. Start to go up hill, I'm too slow. Speed up again. We're fine, but we're going to go too fast in a minute, so I'm going to have to down. I'm going to go fast again, so I have to slow down.

Skip to 1 minute and 36 secondsAnd what we see is different profile for the speed, but the error has gone down from about 21, down to 4.82. So I've done quite well, but it's not perfect control.

Skip to 1 minute and 48 secondsBefore I describe how we go to automatic control, I'm going to redraw the diagram that reflects what's actually been happening. I've still got the robot, but the control action is described by this. Now what actually happens is we are measuring the speed, and that speed is being fed back. And then it's subtracted from the desired speed-- we're comparing the two. And the difference between the two is the error, which I use to determine my control action, whether I speed up or slow down the motor. And the human is what's in the red dashed box. Now we can extend that for automatic control. Same idea-- I've slightly relabeled things, so the output O represents the actual speed.

Skip to 2 minutes and 36 secondsThe input, I, is the desired speed. Otherwise, it's the same. Feedback, O, compute the error, E. And on the basis of that, we use a control block, which will determine what V is. Now control is a device which calculates what the voltage v should be-- what we apply to the motor on the basis of what the error, E, is. And different control strategies available to allow us to do that. The simplest is so-called proportional control. Here, the voltage we're going to apply is some constant C times the error E. Basically, the voltage is the error multiplied by this constant, C, which is the gain of the controller.

Skip to 3 minutes and 18 secondsThat means the voltage is proportional to the error, which is why we call it proportional control, or P control. And the web page supports this with two values of C-- 72, and 792. And we'll explain separately why those numbers are used. But let's see what actually happens.

Skip to 3 minutes and 38 secondsRight, I've selected simple control. And I now specify the desired speed, which is three, which is what we were aiming for before. And I press run. And we see robot going uphill, flat, and then downhill. And at the end, we'll see a graph. And the speed is varying a little bit-- slowed down when we went uphill, speeded up going downhill. But the variation is much less. The problem is, though, that the speed is around 2.7, but we wanted it to be three. We can do better by having the bigger value of C. So if I select better, and restart the run, off it goes. You can't really tell the difference.

Skip to 4 minutes and 24 secondsBut we will see the difference when we look at the graph. Now, you can hardly see any variation. The error's gone down to 1.19. And the actual value is 2.97, which is very close to three, though it's, of course, not quite perfect.

Skip to 4 minutes and 44 secondsNow, proportional control has reduced the effects on the speed of the hills and friction. The speed is more constant, but the actual speed is not necessarily what the desired speed is. But what we've done is somewhat different from the human's control strategy. Because then, when the speed was too slow, I increased V. If it was too fast, I decreased it. So really, we want a controller which sets the value of V to the current value, plus some value associated with the error. And this is what we call integral control, or I control.

Skip to 5 minutes and 16 secondsAnd the key point about integral control is that the speed, O, will be constant only if V is constant, and V will be only constant if E is zero, which is when I minus O is zero. That is, when the desired speed equals the actual speed. Now, for practical reasons, controllers actually combine both the proportional and the integral strategies. So the V is a value which is both proportional to the error, plus a value due to the so-called integral of the error. And we call that proportional plus integral, or P plus I control. And again, the output speed is constant only if the error is zero, which of course is when the desired speed equals the actual speed.

Skip to 6 minutes and 0 secondsAnd again, we can see this on the web page. So here's the web page. I've selected advanced, or P plus I control. Restart the run, off we go.

Skip to 6 minutes and 15 secondsAnd at the end, the graph, it's flat, and the speed is three-- the desired speed, which is actually what we wanted.

Skip to 6 minutes and 24 secondsSo we've seen how we can use feedback control for setting the motor speed, which can be done by a human doing it-- by measuring the speed, looking at that speedometer, comparing it with the desired, and speeding up or down. Automatic control is better, and we've seen how we can do that with proportional control, which is better when the controller gain is high, but again, there are practical reasons why you can't just make the controller gain higher and higher and higher. We've also seen proportional plus integral control, which is better. And it's actually P plus I control, which is used on ERIC.

Skip to 6 minutes and 56 secondsFor the more mathematically minded, there is a little section later on, which describes the relevant calculations which justify the results we've seen in the simulation. But in the meantime, go along on the simulation, and see what happens when you try the different control strategies, but also when you try complicated hills. Steeper ones, ones with different frictional surfaces, and so forth.

So how do we control?

We have seen that motor speed is affected by friction and by whether the robot is travelling up or down a slope - and thus to maintain constant speed, feedback and control are needed.

But precisely how do we control the robot? In the video above, Richard explains how a human can attempt to control the speed, and then shows how it can be done automatically. The video features a web page showing a robot on a simple hill but it also supports other ‘landscapes’. You now have the opportunity to investigate the control strategies on the different landscapes.

If you’re interested in the speed control demo mentioned in this video – you can try the Robot Moving of Different Surfaces Web Page yourself.

Share this video:

This video is from the free online course:

Begin Robotics

University of Reading