Robot Motion Control: Motors, Encoders and Control Loops

Every robot joint or wheel is a small control system: a motor produces torque, a sensor measures what happened and a controller corrects the difference. The usual structure is a set of nested loops controlling current, velocity and position, each typically using a form of PID control. This article explains the main motor and encoder choices and how the loops are arranged and tuned.

At a glance

PID
Proportional, integral and derivative terms acting on the error between target and measurement.
Cascade
Current, velocity and position loops nested, with the inner loop fastest.
Quadrature
Two encoder channels a quarter cycle apart give both position and direction.
4x
Counting every edge on both quadrature channels gives four counts per encoder line.

The problem

Control problems are often mechanical problems in disguise. Backlash in a gearbox, friction that changes with temperature and flexible couplings all limit how tightly a loop can be tuned, and no gain setting removes them. Resonances in the structure set a further ceiling on loop bandwidth.

Others come from the controller. A loop that runs too slowly, noisy derivative terms and integrators that wind up while the motor is saturated all cause overshoot, oscillation or sluggish response.

Tune from the inside out. An outer loop can never be better than the loop it commands.

Cascaded loops

The innermost current loop sets motor torque and usually runs in the motor drive. A velocity loop around it commands current, and a position loop around that commands velocity. Each inner loop should be considerably faster than the loop outside it so the outer loop sees it as nearly ideal.

Add feedforward of velocity and acceleration from the trajectory to reduce tracking lag, limit the integrator when the output saturates, and filter or take the derivative from the measurement rather than the error.

What good looks like

Size the motor and gearing from the required torque, speed and inertia, with margin for acceleration.

Choose feedback resolution from the positioning accuracy, and decide whether absolute position is needed at power-up.

Tune the current, velocity and position loops in that order, then add feedforward and test across the full load range.

Motor types for robots
MotorControlSuits
Brushed DCSimple H-bridge driveLow-cost axes and small mechanisms
Brushless DC / PMSMElectronic commutation, often field-oriented controlEfficient joints and wheels with high power density
StepperOpen-loop steps, or closed loop with an encoderPositioning at moderate speed and load
Smart servoIntegrated drive and position loopSmall joints, prototypes and education
General characteristics. Specific performance depends on the motor, drive and gearing.

A cascaded control structure

  1. Trajectory: Target position and velocity over time
  2. Position loop: Outermost and slowest
  3. Velocity loop: Commands current
  4. Current loop: Innermost and fastest, sets torque
  5. Motor and encoder: Torque out, feedback back
Each loop commands the one inside it. Feedback from the motor and encoder serves all three.

What it changes

Accuracy

The axis reaches its target position repeatably.

Smooth Motion

Tuned loops and feedforward reduce overshoot and vibration.

Robustness

Behaviour stays stable as load and temperature vary.

Safe Behaviour

Saturation, limits and faults are handled predictably.

Where to go next

Incremental encoders need a homing move after power-up; absolute encoders report position immediately. Choose according to whether the robot can safely move to find home.

Plan safety functions such as torque limits and safe stopping early, since they shape the drive and the control architecture.

Problems this prevents

  • Gains tuned around mechanical backlash
  • Integrator windup during saturation
  • A position loop faster than its velocity loop
  • Homing moves that are unsafe

Discuss your project

Email support@aavico.com or use Get in Touch when the website finishes loading.