Motion Control
Motion control makes robots follow planned paths accurately. Learn trajectory planning (trapezoidal and S-curve profiles), cascaded position/velocity/current loops, PID tuning, feedforward, following error, bandwidth and multi-axis coordination.
Knowing the target isn't enough: the robot must move smoothly, quickly and precisely, without overshoot or vibration. Motion control plans the trajectory and closes feedback loops thousands of times per second.
Good motion control is what makes a robot fast yet gentle and accurate.
An analogy
Driving a car smoothly: you plan to accelerate, cruise and brake (trajectory), and constantly correct steering and throttle based on what you see (feedback).
Trajectory planning
Point-to-point moves use trapezoidal velocity profiles (constant acceleration, cruise, deceleration) or S-curves (limited jerk) for smoother motion. Multi-axis moves are synchronised so all joints start and finish together, and Cartesian paths (straight lines, arcs) are converted to joint trajectories through IK.
Cascaded control loops
Inner current (torque) loop → velocity loop → outer position loop. Each inner loop is faster than the outer one. PID (often PI for velocity, P for position) corrects errors; filters suppress resonances.
Feedforward and following error
Feedback reacts after an error appears; feedforward uses the planned velocity, acceleration and dynamic model to supply the torque in advance, reducing following error dramatically. Following error is the live difference between commanded and actual position.
Bandwidth, resonance and advanced control
Structural resonances (gearbox and link compliance) limit achievable bandwidth; notch filters and input shaping help. Model-predictive control, adaptive and robust control, impedance/admittance control (for contact) and iterative learning control (repeated tasks) extend performance.
Formulas
- Trapezoidal profile:
t_a = v_max/a_max, d_a = v_max²/(2a_max), t = 2t_a + (D − 2d_a)/v_max - Triangular (short moves):
if D < v_max²/a_max: t = 2√(D/a_max) - PID:
u = K_p e + K_i ∫e dt + K_d de/dt - Feedforward:
u_ff = K_v·v_ref + K_a·a_ref (+ model torque)
Worked example: Move time
Given: 90° (1.571 rad), v_max = 1 rad/s, a_max = 2 rad/s²
Find: Profile timing.
- t_a = 0.5 s, d_a = 0.25 rad each end
- Cruise = 1.571 − 0.5 = 1.071 rad → 1.071 s
- Total = 0.5 + 1.071 + 0.5 = 2.07 s
Answer: 2.07 s
Worked example: Short move
Given: Move 0.3 rad with same limits
Find: Time.
- v_max²/a_max = 0.5 > 0.3 → triangular
- t = 2√(0.3/2) = 0.775 s (peak speed 0.775 rad/s)
Answer: 0.775 s
Trapezoidal profile + PID servo loop (Python-style)
def trapezoid(D, vmax, amax):
ta = vmax / amax
if D < vmax * ta: # triangular move
ta = (D / amax) ** 0.5
return 2 * ta
return 2 * ta + (D - vmax * ta) / vmax # accel + cruise + decel
class PID:
def __init__(s, kp, ki, kd, dt):
s.kp, s.ki, s.kd, s.dt = kp, ki, kd, dt
s.i = 0.0; s.prev = 0.0
def update(s, ref, meas, ff=0.0):
e = ref - meas
s.i += e * s.dt
d = (e - s.prev) / s.dt
s.prev = e
return ff + s.kp*e + s.ki*s.i + s.kd*d
print(trapezoid(1.5708, 1.0, 2.0)) # 2.07 s for a 90° moveReal servo drives run current loops at ~10–20 kHz, velocity at ~2–5 kHz and position at ~1 kHz, with anti-windup and filters.
Common mistakes
- Wrong: Relying on feedback gains alone for fast tracking. — Right: Add velocity/acceleration feedforward.
- Wrong: Using infinite-jerk profiles on flexible machines. — Right: Use S-curves or input shaping to avoid exciting resonances.
Applications
- Industrial robots: Coordinated 6-axis motion with dynamic feedforward and path accuracy.
- CNC & gantries: Jerk-limited profiles and look-ahead for high-speed contouring.
- Semiconductor & packaging: Fast point-to-point moves with minimal settling time.
Key takeaways
- Plan trapezoidal/S-curve trajectories within v, a, j limits.
- Cascaded current → velocity → position loops.
- Feedforward + feedback = fast and accurate.
- Resonances limit bandwidth — filter and shape inputs.
Going further
- Time-optimal path parameterisation: TOPP finds the fastest traversal of a given path under torque limits.
- Impedance control: Makes the robot behave like a programmable spring-damper for safe contact.
- Iterative learning control: Repetitive tasks learn a correction signal cycle by cycle.