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

Worked example: Move time

Given: 90° (1.571 rad), v_max = 1 rad/s, a_max = 2 rad/s²

Find: Profile timing.

Answer: 2.07 s

Worked example: Short move

Given: Move 0.3 rad with same limits

Find: Time.

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° move

Real 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

Applications

Key takeaways

Going further