Visual servoing uses visual feedback to guide a robot arm. You can think of it as a tracking problem.

From joint error to pose error
Each joint in a robot is already doing something similar: its controller tries to follow the position commanded by a trajectory. Interpolation gives us the desired joint angle , while an encoder gives us the current angle . The error is simply .
Once we have that error, a control algorithm can reduce it and move the arm toward the planned position. With a familiar PID controller, the idea is:
In visual servoing, a calibrated vision system gives us the tool's current pose and target pose in the same camera frame. We would naturally calculate their difference and feed it to a tracking controller.
But what, exactly, is the difference between two rigid-body poses?
Rotations live in a different space
We usually separate a pose into a position and an orientation . Position is straightforward: a three-dimensional vector, . Orientation has several common representations, including a rotation matrix, a quaternion, and Euler angles.
The distinction matters because positions lie in a Euclidean space, while orientations lie in the Lie group SO(3).
For two positions and , the shortest path is a straight line:
For orientations, simply adding and subtracting the coordinates of a chosen representation does not give us the same construction. Think of an airline route: the shortest route is not the straight line obtained by connecting two latitude–longitude pairs on a flat chart. It follows a geodesic.

For the visual-servo controller, we want a direction along a shortest geodesic toward the target orientation. Direct linear interpolation of Euler-angle or quaternion components can lead to tracking problems, including failure to converge or singularities.
This is where Lie groups and Lie algebras come in. A rigid-body pose belongs to SE(3), where we can calculate a direction between poses using the group's operations:

For an orientation-only example in SO(3), compare interpolation on the group with interpolation of Euler angles:

The Lie-group result appears to take a shorter route.
Putting the error into a controller
Once we define these operations for poses in SE(3), we can write our visual-servo controller in a familiar form:
With that in place, visual tracking becomes quite straightforward:

Add accurate vision and robot control, and we can try something more entertaining—threading a needle:

Here's the full demo: