# What is the actual physical actuated quantity when controlling the position of a servo?

I'm trying to learn about servo control. I have seen that the most generic position control method for servos is PID, where the control input is position error. However, I am not sure about what is the actuated quantity. I am guessing that it is one of:

• Voltage applied to the motor
• Current applied to the motor

I am then guessing that the actuated quantity gets turned into one of:

• Torque that the motor exerts
• Angular velocity that the motor runs at

I haven't been able to get my hands on and explicitly control a physical servo so I cannot confirm that the actuated quantity is any of these. I know very little of the electronics that controls the motor. It might well be that the controlled quantities are different for different series servos.

My bet is on torque control. However, assume that the servo is holding a weight at a distance (so it is acting against gravity), which means an approximately constant torque load. In this case, if the position error is zero and the servo is at rest, then each of P, I and D components are zero, which means the exerted torque is zero. This would cause the weight to sink, which is countered by the error in its position causing P,I components to increase. Wouldn't this situation cause the lifted weight to oscillate and balance at a constant position which is significantly different from the goal position? This isn't the case with the videos of servos I have seen lifting weights. Or is this the case and friction is smoothing everything out? Please help me understand.

## motor controllers

what is the actuated quantity

Yes, the output of the control electronics and the input of the motor, in the simplest case -- DC permanent-magnet motors -- is the voltage applied to the motor.

In other cases, the output of the control electronics is the duty cycle of a PWM voltage applied directly to the motor or indirectly to the "signal" wire of a radio control servo. They work a little differently.

In yet other cases, many people control position using stepper motors. They work very differently than DC permanent-magnet motors.

## motors

the actuated quantity gets turned into

Your suggestion of "torque control" is approximately true when motor very slow or stopped.

The so-called "back-EMF" generated by the motor by "generator action" is proportional to its angular velocity. This back-EMF allows motors to be used as generators, such as the motor/generators used in a few cars and the regenerative breaking used in a few vehicles. (Part of the back-EMF is caused by the "autoinductance" of the windings, but that part is usually negligible, so I will not mention it further -- the article you mentioned has a good explanation).

At any instant, the electrical current in the motor is proportional to the applied voltage minus the back-EMF. Meanwhile, the mechanical torque generated by the motor is approximately proportional to that electric current.

Therefore at low speeds the mechanical torque generated by the motor is proportional to the applied voltage. But at high positive speeds, the torque generated by the max positive voltage is less; the "max speed" is often defined as the speed where the max positive voltage gives zero torque.

## PID

assume that the servo is holding a weight at a distance (so it is acting against gravity), which means an approximately constant torque load. In this case, if the position error is zero and the servo is at rest, then each of P, I and D components are zero, which means the exerted torque is zero. This would cause the weight to sink, which is countered by the error in its position causing P,I components to increase. Wouldn't this situation cause the lifted weight to oscillate and balance at a constant position which is significantly different from the goal position?

There are 2 different cases: the short-term state immediately after some heavy load is applied, and the long-term state after the arm is allowed to settle.

Please tell the person who told you that "if the position error is zero and the servo is at rest, then the I component is zero" to experiment with a PID controller, or read a little more about control systems (a, b, c, d, e), or both, to fill in the gaping hole in his knowledge of what the I component does in a PID controller.

PID with near-zero I component

In the short term, the P, I, and D components start out at approximately zero, and so the exerted torque is approximately zero. When Fred suddenly applies a heavy load, there is not enough torque to hold it in position, so it sinks. The error in its position causes the P,I components to increase. If, hypothetically, one had a controller where the I component was completely ignored, then the arm would settle at some constant position, as you mentioned. The arm would stabilize at the position where the voltage supplied by the controller (proportional to P, the error in position) was exactly enough to hold up the weight.

PID with significant I component

However, with the PID controller you mentioned, the I component increases as long as there is any error. Eventually there would be enough I component accumulated that the controller would increase the voltage more than enough to hold up the weight, pushing the weight back up towards the zero-error point. Whether the weight overshoots or not depends on how the PID controller is tuned, but as long as the P,I,D components are anywhere close to a reasonable value, the PID controller will eventually settle down to the state where:

• the arm is stable at almost exactly the goal position (with practically zero error)
• therefore the P and D components are practically zero
• The I component is not zero -- it still has some large value that accumulated previously when the arm was below the desired position.
• the control electronics (because the I component is not zero) drive the motor with some voltage
• the motor converts that voltage into some torque that holds the weight up at the goal position.

Many robotic control systems are quick enough that they converge on this final state within a tenth of a second.

When Fred (that prankster!) yanks the weight off the arm, even though the arm is already at the goal position, the high accumulated I component causes the arm to pop up. That small error causes the accumulated I component to bleed off, and (hopefully soon) the arm returns to almost exactly the goal position (with practically zero error).

• Excellent answer David, I think it's worth mentioning that the important mistake in the question is that a servo cannot be at rest if there is a force (such as gravity) pushing the axis away from its demanded position. You go on to explain the specifics well, but calling out that explicitly might help the point you are making. Mar 19 '13 at 1:10

Your intuition is right but your question is actually a bit off, I would say. The variable controlled is indeed position. What you want to know is what variable is actuated, that is, what do we use to control position.

I don't know much about the internals of servomotors, but when performing PID control of DC motors it is quite common to use the voltage applied to the motor through pulse-width modulation.

Regarding the second part of your question, part of what you see is probably due to the gears or simply appropriate tuning of the controller, but I can't say much about it without seeing the videos you mention.

If you want to know more about the interplay of angular velocity, torque, etc., you should look up DC motor models, which is one of the building blocks of servos. That way you will find that it is common to assume that angular velocity is proportional to armature current and other things, and understand how the blue box the white paper you mentioned represents the motor.

• Thank you, that explains one part of my question. I also updated the "controlled" term to "actuated". It is more appropriate for my question. Mar 10 '13 at 9:08
• Thanks for the suggestion on looking up DC motor models. In one paper I've encountered (inf.fu-berlin.de/lehre/SS05/Robotik/motors.pdf), it is stated that the voltage $E$ applied to the motor is proportional to its angular velocity $w$. Applying a PWM signal to it should result in an RMS voltage level depending on its duty cycle. Therefore, we are actually controlling the angular velocity on the motor, as long as its related torque on the torque to angular velocity curve is enough to counter the load we're driving. Mar 10 '13 at 17:43
• Actuating duty cycle (voltage) is the simplest method of controlling a servo, but there are many better ways of controlling a servo. For example, in flux vector control, the orientation of the magnetic field is also controlled which requires controlling the current flowing through each phase. en.wikipedia.org/wiki/Vector_control_(motor) Mar 14 '13 at 5:52

If you are speaking about RC style servos, then the actual drive to the motor is in the form of a pulse width modulated voltage: the servo amplifier just turns the motor on fully in one direction or the other, for a length of time determined by the difference between the measured position and the target position as determined by the width of the incoming pulse.

Life is complicated by the newer "digital" servos -- I can't swear to the internal workings of these, but the drive to the motor is almost certainly PWM of some sort, just at a faster rate than the old-style analog servo amplifiers. There's no reason that it couldn't be as described below, except that there is precious little room inside of an RC servo, so there's a good chance that no current measurement is done, and hence that the parameter that the microprocessor controls is the PWM duty cycle.

How servo mechanisms in industry are controlled is a much wider answer: basically, it can happen any way that the designer thought was appropriate. Motor drive can be via a linear amplifier that is configured to drive a current or a voltage, or it can be via a switching amplifier (i.e. PWM). In the case of a switching amplifier, the amplifier itself can be either analog or digital and (through feedback) configured for either constant-current, constant-voltage, or constant duty cycle.

Usually in a "pro" servo mechanism with a brushed or brushless motor there will be an inner loop that servos the motor current (and therefor torque). This is not so much to provide any big advantage in control as it is because it vastly simplifies current limiting to the motor, which is necessary if you want to keep all that expensive smoke inside the motor where it belongs. That inner current (and hence torque) loop will often be wrapped by a speed loop that either senses the speed of the motor shaft or that deduces it from the motor's back-EMF (and which provides a convenient means of speed limiting the motor, if that is necessary). Finally, that speed loop is wrapped by a position loop.