Manipulator Basics · Theory · Module 11 of 14
11 — Manipulator Control
A trajectory is only a wish until a controller makes the joints follow it. Compare joint PID, PID with gravity compensation and computed-torque control on a simulated 2R arm with real dynamics, read the step-response metrics, and see how impedance and admittance control handle contact.
Every robot joint has a motor, a sensor and a control loop. How much the controller knows about the arm's dynamics decides how accurately it tracks, how it handles payloads and disturbances, and how safely it touches the world.
Learning objectives
After this module you should be able to:
- Describe the position, velocity and torque command interfaces of a robot joint and the cascaded loops behind them.
- Implement and tune a joint PID, and explain anti-windup and derivative filtering.
- Explain why gravity compensation removes the need for large integral action.
- Derive computed-torque control and state its sensitivity to model errors.
- Explain impedance and admittance control and when each is used.
- Measure overshoot, rise time, settling time and steady-state error from a response.
Conceptual explanation
A joint can be commanded at three levels. A torque (current) command sets the motor torque directly: it gives the most freedom, needs a good model, and is what collaborative and research arms expose. A velocity command closes a velocity loop in the drive. A position command closes position, velocity and current loops in cascade inside the drive, the usual interface of industrial robots. Inner loops run faster (current at about 10–20 kHz, velocity at about 1–4 kHz) than outer ones (position or trajectory at about 0.25–1 kHz).
Joint PID
Each joint is controlled independently, and the coupling from other joints and gravity is treated as a disturbance. The proportional term pulls the joint towards the reference, the derivative term damps the motion, and the integral term removes steady errors, for example the sag caused by gravity. Practical PIDs filter the derivative, apply it to the measurement rather than the error (no "derivative kick" at reference steps), and stop integrating while the motor is saturated (anti-windup).
Using the model
- Gravity compensation adds the model's to the PID output, so the feedback loop only handles the dynamic errors.
- Computed-torque control (inverse-dynamics control) uses the full model to cancel the nonlinear dynamics, leaving each joint as a double integrator controlled by a PD loop with the same response in every pose. It is excellent when the model is right and degrades when it is wrong.
Interaction control
Position control fights contact: if the tool touches a surface 1 mm before the program expects, a stiff position loop pushes as hard as it can. Impedance control makes the robot behave like a programmable spring and damper around its reference: it measures motion and commands force or torque. Admittance control does the opposite: it measures the contact force with a force/torque sensor and turns it into a motion of the reference, which a stiff position-controlled robot then follows. Impedance suits torque-controlled, backdrivable arms; admittance suits stiff industrial arms with a wrist force sensor.
Step-response metrics
- Overshoot: how far the response passes the target, as a percentage of the step.
- Rise time: time from 10% to 90% of the step.
- Settling time: time after which the response stays within ±2% of the target.
- Steady-state error: the remaining offset once the response has settled.
Mathematical formulation
Computed torque: cancel the dynamics with the model, then command the acceleration v.
The error obeys a linear, decoupled second-order equation: choose Kp = ωn² and Kd = 2ζω_n.
With model errors, the right-hand side acts as a disturbance; with no integral term it leaves a steady error.
An impedance controller computes and applies plus gravity compensation. An admittance controller integrates the target equation from the measured to obtain a modified reference for the position loop.
Diagrams
Worked examples
Example 1: tracking a quintic move with five controllers
The 2R arm of Module 09 moves from to in 1.5 s, simulated for 3 s at 1 ms with a 500 Hz controller, torque limits of 40 and 20 N·m, and gains , , ; the computed-torque loop uses .
| Controller | RMS error q₁ (mrad) | Max error q₁ | Final error q₁ | RMS error q₂ | Final error q₂ |
|---|---|---|---|---|---|
| PD (no integral, no model) | 123.2 | 147.8 | 146.9 | 28.0 | 9.1 |
| PID | 84.9 | 107.0 | 69.2 | 24.7 | 6.0 |
| PID + gravity compensation | 19.2 | 41.1 | 0.5 | 9.1 | 1.5 |
| Computed torque (exact model) | 0.1 | 0.3 | 0.0 | 0.7 | 0.0 |
| Computed torque, masses 20% wrong | 36.9 | 48.2 | 48.2 | 42.5 | 52.9 |
Without an integral or a model, gravity leaves the shoulder sagging by 146.9 mrad (8.4°). The integral term removes part of it within the 3 s; gravity compensation removes it at once. With an exact model, computed torque tracks almost perfectly. With masses 20% wrong and no integral term, it settles with an error of about 48.2 mrad.
Example 2: rejecting a disturbance
At s, a 3 N·m torque pulse lasting 0.2 s hits the elbow (as if someone pushed the forearm):
| Controller | Peak elbow error (mrad) | Final elbow error (mrad) |
|---|---|---|
| PID + gravity compensation | 87.8 | 4.0 |
| Computed torque (PD outer loop) | 552.3 | 4.4 |
The computed-torque loop multiplies its PD output by the elbow's small effective inertia, so its corrective torque is small and the push moves the forearm much further. The PID has fixed torque gains and resists more firmly. A good model improves tracking, but it does not replace feedback gain or an integral term.
Example 3: step-response metrics
A step from to with PID and gravity compensation (a step is harsher than any real reference):
| Joint | Overshoot | Rise time | Settling time (±2%) | Peak torque | Time saturated |
|---|---|---|---|---|---|
| 1 | 11.9% | 0.145 s | 0.57 s | 40.0 N·m | 0.10 s |
| 2 | 3.3% | 0.240 s | 2.31 s | 20.0 N·m | 0.01 s |
Both motors hit their torque limits at the start: a step asks for more than the motors can give, which is why references are always smooth trajectories (Module 10).
Example 4: an impedance-controlled tool against a wall
Choose a target stiffness N/m and an apparent mass kg, with critical damping N·s/m. If the commanded position lies 20 mm inside a rigid wall, the robot presses with N instead of the full motor torque a stiff position loop would produce. An operator pushing the tool with 10 N displaces it by mm, and it returns without overshoot. (This example is analytic; the labs simulate free motion only.)
Interactive experiment
Interactive PD step response (needs JavaScript).
Real-world applications
- Industrial arms run cascaded position, velocity and current loops in the drives, with feedforward from a dynamic model at higher speeds.
- Collaborative robots use torque sensing and impedance control for hand guiding and gentle contact, and model-based collision detection.
- Polishing, deburring and assembly use admittance or hybrid force/position control with a wrist force/torque sensor.
- ROS 2: ros2_control exposes position, velocity and effort command interfaces; joint trajectory controllers track trajectories through them (see the ROS 2 bridge page).
Tune these controllers yourself in Lab 08.
Common mistakes
Fixing gravity sag with a huge integral gain
A large Ki causes overshoot, slow oscillation and windup. Add gravity compensation and keep Ki for what remains.
Forgetting anti-windup
While the motor saturates, the integral keeps growing and later causes a big overshoot. Stop integrating (or back-calculate) during saturation.
Differentiating a noisy encoder signal without a filter
The derivative amplifies quantisation noise; filter it or use the drive's velocity estimate.
Trusting computed torque with a wrong model
Payload or mass errors leave tracking errors and, without an integral, steady offsets. Identify the model and keep feedback robust.
Position-controlling into contact
A stiff position loop against a surface produces large forces. Use impedance or admittance control, or limit force and speed.
Key takeaways
- Drives offer torque, velocity or position interfaces built from cascaded loops.
- Independent joint PID works but treats gravity and coupling as disturbances; gravity compensation removes the largest one.
- Computed torque linearises and decouples the arm with an exact model, and degrades gracefully but measurably with model errors.
- Impedance (motion in, force out) and admittance (force in, motion out) control contact behaviour.
Knowledge check
Write an answer to each question, then reveal the explanation. Your answers stay in your browser.
Question 1
Why does a PD joint controller on an arm in a vertical plane leave a steady error?
Explanation
At rest the PD output is Kp·e, which must equal the gravity torque, so e = g(q)/Kp ≠ 0. An integral term or gravity compensation removes it.
Question 2
In computed-torque control with an exact model, what equation does the error satisfy?
Explanation
ë + Kd ė + Kp e = 0: linear, decoupled and identical in every pose.
Question 3
What does anti-windup prevent?
Explanation
The integral term growing while the actuator is saturated, which would cause a large overshoot once the error changes sign.
Question 4
When would you choose admittance control over impedance control?
Explanation
On a stiff, position-controlled industrial arm with a force/torque sensor, where you cannot command joint torques directly.
Question 5
A response reaches 112% of the step and stays within ±2% after 0.6 s. Name the two metrics.
Explanation
12% overshoot and a settling time of 0.6 s.
Practise it in the labs
Then test yourself in practice exercises and challenge mode.
References and further reading
- K. J. Åström and T. Hägglund, Advanced PID Control, ISA, 2006.
- N. Hogan, "Impedance control: an approach to manipulation, parts I–III", ASME Journal of Dynamic Systems, Measurement and Control, 107, 1985.
- B. Siciliano, L. Sciavicco, L. Villani and G. Oriolo, Robotics: Modelling, Planning and Control, Springer, 2009, chapters 8–9.