QQFLY.NET
← Writing

Lie groups in robotics: visual servoing

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

A robot tracking a target using visual feedback

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 qdq_d, while an encoder gives us the current angle qcq_c. The error is simply e=(qd−qc)e=(q_d-q_c).

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:

I=PID(qd−qc)I=PID(q_d-q_c)

In visual servoing, a calibrated vision system gives us the tool's current pose TcT_c and target pose TdT_d 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 pp and an orientation RR. Position is straightforward: a three-dimensional vector, p=[x,y,z]Tp=[x,y,z]^T. Orientation has several common representations, including a 3×33\times3 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 p1=[x1,y1,z1]Tp_1=[x_1,y_1,z_1]^T and p2=[x2,y2,z2]Tp_2=[x_2,y_2,z_2]^T, the shortest path is a straight line:

p(λ)=(1−λ)⋅p1+λ⋅p2(0≤λ≤1)p(λ) = (1-λ) \cdot p_1 + λ \cdot p_2 \quad (0 \leq λ \leq 1)

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.

A geodesic flight path between two places on Earth

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:

A curved space and its tangent directions

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

Lie-group interpolation compared with Euler-angle interpolation
Left: Lie-group interpolation. Right: Euler-angle interpolation.

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:

I=PID(Td−Tc)I=PID(T_d-T_c)

With that in place, visual tracking becomes quite straightforward:

A robot arm tracking a handheld target

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

Threading a needle with visual servoing

Here's the full demo:

← Writing