Skip to content
DroidBazaar

Control and navigation

Control loops and encoders: how a robot holds its position

Robots move precisely because they measure and correct themselves many times per second. Learn how encoders measure angles, what a PID controller does and why feedback makes robots safe.

Motors do not know where they are. A robot places its tool accurately because it constantly measures each joint and corrects the motor command. This is closed-loop control.

Block diagram: target, subtraction, controller, driver and motor, joint, with an encoder feeding the measured angle back.
Closed-loop control: the controller compares the target with the measured angle and adjusts the motor until the error disappears. (DroidBazaar, CC BY 4.0 (opens in a new tab))

Encoders: measuring angles

An encoder is a sensor that measures rotation.

  • Optical encoders shine light through a patterned disc; they are very precise.
  • Magnetic encoders read a magnet with a sensor chip; they are compact, robust and cheap.
  • Incremental encoders count steps from a reference, so the robot must "home" after power-up.
  • Absolute encoders know the exact angle at any moment, even right after switching on.

Robot joints often have one encoder on the motor and, in precise or safety-rated designs, a second one on the output after the reducer.

A round disc with three concentric rings divided into black and white segments, so each of eight sectors has a different pattern.
Diagram of a 3-bit absolute encoder disc whose concentric tracks give each of eight angular sectors a unique binary code. (jjbeard (opens in a new tab), Public domain (opens in a new tab))

The controller

The controller compares the target with the measured value and decides how much torque to ask for. The classic method is PID:

  • Proportional: push harder the further away you are.
  • Integral: remove small errors that persist over time, such as the effect of gravity.
  • Derivative: damp the motion so the joint does not overshoot and oscillate.

Real robots nest several loops: an inner current (torque) loop in the motor driver, then velocity and position loops, often running thousands of times per second.

From joints to the tool: kinematics

A controller for the whole arm must translate a desired tool position into joint angles. Forward kinematics computes where the tool is from the joint angles; inverse kinematics does the opposite. The number of joints is the robot's degrees of freedom (DOF): six are enough to place a tool at any position and orientation within reach; a seventh gives an arm freedom to avoid obstacles.

Why feedback matters for safety

Collaborative robots measure joint torques or motor currents to detect unexpected contact and stop. That only works because the control loop knows at every moment what the joints should be doing and what they are really doing.

Compare repeatability and degrees of freedom across cobots in the catalog; every value links to its source.

Further reading

Robots to explore

← All guides