Exponential and logarithm maps: turn a body twist into a pose

Exponentiate a constant planar body twist, calculate its coupled translation, and recover a chosen logarithm. Explore straight-motion limits, half-turn branch choices, and information lost in a full turn.

By 13 min read

What you will learn

  • Convert planar exponential coordinates into a rigid pose using a matrix exponential.
  • Explain why the final world translation differs from the integrated body translation coordinates.
  • Recover a chosen Lie logarithm and verify the pose after exponentiating it.
  • Identify the zero-angle limit, half-turn ambiguity, and loss of full-turn information.

Before you start

A robot moves forward while turning 90°. Its forward direction changes throughout the motion, so the final world displacement has two components. Applying one straight displacement and attaching a final heading describes a different path.

The matrix exponential turns a constant body twist into a rigid pose. A logarithm map chooses exponential coordinates for an observed pose, but that choice cannot recover every detail of the motion that produced it.

State the pose, frame, and motion convention

We use planar rigid motions in SE(2). The matrix T_WB maps column coordinates in body frame B into world frame W. World x points right, world y points up, and positive rotation turns counterclockwise.

The homogeneous transformation convention gives:

T =
[ cos θ, −sin θ, p_x ]
[ sin θ, cos θ, p_y ]
[ 0, 0, 1 ]

The translation p is the body's origin expressed in world coordinates. We start at identity, with both frames aligned and both origins at (0, 0).

Write the integrated body coordinates in angular-first order as ξ = (θ, ρ_x, ρ_y). The vector ρ has units of metres; θ is an angle in radians. These are exponential coordinates, and ρ generally differs from the endpoint translation p.

The experiment uses a dimensionless motion parameter 0 ≤ s ≤ 1. For a physical duration τ with constant body velocity v_b and angular velocity ω, set ρ = τv_b and θ = τω. Then physical time is sτ; the experiment does not assume a particular τ.

The twists and screw axes lesson extends this model to three dimensions. It separates the current velocity from the accumulated motion and shows how a point moves around, and along, a screw axis.

Exponentiate the generator matrix

The hat symbol puts the three coordinates into a matrix in the Lie algebra se(2):

ξ̂ =
[ 0, −θ, ρ_x ]
[ θ, 0, ρ_y ]
[ 0, 0, 0 ]

Its bottom row is zero because ξ̂ describes an infinitesimal generator. The pose's bottom row will be (0, 0, 1).

Define the matrix exponential using matrix products:

exp(ξ̂) = I + ξ̂ + ξ̂²/2! + ξ̂³/3! + ⋯

This is a matrix function. Applying the scalar exponential to each entry would give a different result, including an incorrect bottom row. Higham defines the matrix exponential and its connection to linear differential equations.

For this constant body twist, T(s) = exp(sξ̂) solves T′(s) = T(s)ξ̂, with T(0) = I. At a general initial pose T₀, the same body-coordinate motion gives T(s) = T₀exp(sξ̂). Modern Robotics explains why a body-frame increment multiplies on the right.

Integrate translation while the body turns

The rotation at s is R(sθ). The body's velocity components remain constant in its own rotating frame, while its world translation rate is p′(s) = R(sθ)ρ. Integrating that rate from zero to one gives:

p = V(θ)ρ
V(θ) = [ A, −B; B, A ]
A = sin θ/θ
B = (1 − cos θ)/θ

For example, when ρ = (1, 0), the world rate is (cos(sθ), sin(sθ)). Its two integrals are A and B. This calculation explains the translation coupling directly: rotation changes where each increment of body translation points.

At θ = 0, use the continuous limits A = 1 and B = 0. Then V(0) = I and p = ρ, a straight translation. The written fractions have removable singularities there.

Near zero, evaluate them carefully. The expansions A = 1 − θ²/6 + θ⁴/120 + ⋯ and B = θ/2 − θ³/24 + θ⁵/720 + ⋯ retain small terms that direct subtraction in 1 − cos θ can lose. Another useful identity is 1 − cos θ = 2sin²(θ/2).

Eade derives this SE(2) exponential and its stable small-angle form in Section 5. Some software uses different definitions for functions named sinc or cosc; the formulas above specify this lesson's exact convention.

Calculate a quarter-turn with forward motion

Choose ρ = (1, 0) m and θ = π/2. One physical interpretation is forward body velocity 0.2 m/s and angular velocity π/10 rad/s, both held for five seconds.

The coefficients are A = 2/π and B = 2/π. Therefore:

p = (2/π, 2/π) m
p ≈ (0.636620, 0.636620) m

The final rotation turns +x to +y. The full pose is:

T(1) =
[ 0, −1, 2/π ]
[ 1, 0, 2/π ]
[ 0, 0, 1 ]

The body origin traces a quarter-circle of radius 2/π metres. Its path length is 1 metre, matching the integrated forward speed. Its endpoint displacement has length 2√2/π ≈ 0.900316 metres, so path length and displacement differ too.

At s = 0.5, scale both coordinates: use ρ/2 and θ/2 in the exponential. Scaling only the final translation would draw a straight chord and miss the constant-twist path.

Recover a logarithm from the final pose

Given a valid SE(2) pose, recover an angle from its rotation block using φ = atan2(R₂₁, R₁₁). We choose φ in (−π, π], taking +π at the half-turn tie.

Next calculate A and B at this chosen φ and solve V(φ)ρ_log = p:

ρ_log,x = (Ap_x + Bp_y)/(A² + B²)
ρ_log,y = (−Bp_x + Ap_y)/(A² + B²)

On this chosen angle interval, A² + B² is positive, including the limiting value 1 at zero. The translation solve is therefore well-defined. For the worked quarter-turn, it returns ρ_log = (1, 0) and φ = π/2.

Putting these recovered coordinates into a new generator L gives exp(L) = T. That verifies a logarithm of the pose. It does not prove that L equals an original generator that traveled through more turns.

At rotations strictly between −π and π, this choice agrees with the principal matrix logarithm. A half-turn has eigenvalues on the negative real axis, outside that principal logarithm's usual domain. Our +π tie is an explicit real Lie-logarithm choice. Higham explains the principal logarithm's domain and the wider nonuniqueness of matrix logarithms.

Track branch choices and lost turns

The exponential map is locally invertible near the zero generator. Globally, different generators can produce the same pose. Angle wrapping alone does not fix the translation coordinates; V changes with the selected angle.

For ρ = (1, 0) and θ = −π, the endpoint translation is (0, −2/π). Our logarithm chooses φ = +π and ρ_log = (−1, 0). Both generators reach the same endpoint through different half-circle paths.

For θ = 3π/2, the chosen angle is −π/2 and the recovered translation coordinates are (−1/3, 0). Reusing ρ = (1, 0) with the wrapped angle would reach the wrong translation.

At θ = 2π, both A and B are zero, so V(2π) = 0. Every finite ρ produces zero endpoint translation for this full-turn planar constant twist. The final rotation is identity too.

Our logarithm of identity gives zero coordinates. It cannot recover the original ρ or the completed turn. The original body origin can have traced a nonzero-radius circle even though the final pose contains no record of it.

Crossing the half-turn boundary also makes the chosen logarithm jump. Nearby poses can have very different coordinate vectors on opposite sides of that branch. A method that compares or averages those vectors must account for that choice.

Compare the original path with the chosen-log path

The amber curve follows exp(sξ̂) for the supplied coordinates. The blue dashed curve follows exp(sL) for the chosen logarithm of the endpoint. Their final poses agree, while their intermediate poses can differ.

A constant body twist in SE(2)

Exponentiate a motion, then take the pose’s logarithm

T(s) = exp(sξ̂), starting from identity. ρ gives integrated body translation coordinates in metres; θ gives the turn. s runs from zero to one.

1.00
0.00
90
1.00
  • Amber: input-twist path
  • Blue dashes: chosen-log path
Two constant-twist paths with the same final poseWorld coordinates in metres, with equal horizontal and vertical scales. The body starts at the world origin. The input twist follows the amber path to (0.636620, 0.636620). The dashed blue path uses the chosen logarithm and has the same final pose. The filled marker and black body axes show motion parameter 1.00 at (0.636620, 0.636620). Paths can coincide or collapse to a point.-1.5-1.50.00.01.51.5xy
World x points right and world y points up, both in metres with equal scale. The open gray marker is the start; the amber ring is the endpoint. The filled marker shows the original motion at s, with body x solid and body y dashed. Each body-axis arrow has display length 0.25 m. Plot bounds follow the paths and current axes.
Input ρ (m)
(1.000000, 0.000000)
Input θ (rad)
1.570796
Position at s (m)
(0.636620, 0.636620)
Unwrapped heading at s (degrees)
90.000
Endpoint translation (m)
(0.636620, 0.636620)
Chosen log ρ (m)
(1.000000, 0.000000)
Chosen log angle (degrees)
90.000
Translation round-trip error (m)
0.000000
Rotation round-trip error
0.000000
Input coordinates recovered
Yes
Endpoint pose T(1), mapping body coordinates to world coordinates
0.000-1.0000.637
1.0000.0000.637
0.0000.0001.000

The chosen logarithm recovers these input coordinates. Exponentiating it reconstructs the final pose, and both plotted paths coincide.

The chosen log uses angles in (−180°, 180°], with +180° at the tie. Matrix and log readouts describe the final endpoint; s moves only the current-pose marker and its two readouts. Recovered input coordinates agree within numerical tolerance. Rotation round-trip error is the Frobenius norm of the two rotation blocks’ difference; translation error is a distance in metres. Displayed zeros can hide floating-point roundoff.

Use Straight translation to check V(0) = I. Use Clockwise quarter-turn to change the sign of the y displacement. The Negative half-turn preset exposes the +180° tie and its changed ρ_log.

With Full turn, move s back from 1. The current-pose marker travels around the original circle, while the chosen-log path stays at identity. The endpoint and its logarithm remain fixed as s changes.

With Rotation without translation, the origin stays still while its body axes turn. A position-only plot cannot establish that two complete poses agree, so inspect the heading and rotation matrix too.

The experiment reports translation reconstruction error in metres. Its rotation reconstruction error uses the Frobenius norm of the difference between rotation blocks, a dimensionless quantity. A printed zero can hide floating-point roundoff.

Use the maps without assuming a shortest path

Robot odometry can use a constant body twist over a short interval. The exponential integrates that assumed twist exactly; changing velocities, wheel slip, and incorrect measurements still create model error. General time-varying twists require further integration or a sequence of increments.

For one fixed generator X, exp(aX)exp(bX) = exp((a + b)X). Different generators generally do not commute, so summing arbitrary twist coordinates can change the resulting pose. Composition order remains part of the model.

In pose estimation or learning, a local correction can update a prediction through T_new = T exp(δξ̂). This keeps the updated pose in SE(2). A logarithm of a relative pose can supply local error coordinates, provided the frame convention and branch are consistent.

Combining metre-valued and radian-valued errors in a loss also requires a stated scale or weighting. A small unweighted coordinate vector does not automatically mean low physical cost, low energy, or safe motion.

The Lie-group exponential here comes from constant-twist group motion. A Riemannian exponential follows a manifold's geodesics under a chosen metric. These constructions need not coincide, and this experiment makes no shortest-path claim. The geodesic lesson develops that metric-dependent question.

The unit-quaternion lesson shows another representation ambiguity: opposite quaternion signs encode the same rotation. Neither quaternions nor a chosen logarithm recover motion history from a final pose alone.

Reproduce five branch cases in Python

This Python 3 example uses the standard library. It stores each pose as (cos θ, sin θ, p_x, p_y), with the homogeneous matrix structure understood. The reconstruction assertions compare the final pose, including its rotation.

from math import atan2, cos, hypot, pi, radians, sin


def coefficients(theta):
    if abs(theta) < 1e-4:
        z = theta*theta
        return 1-z/6+z*z/120, theta*(0.5-z/24+z*z/720)
    return sin(theta)/theta, 2*sin(theta/2)**2/theta


def exp_pose(rho, theta):
    a, b = coefficients(theta)
    x, y = rho
    return cos(theta), sin(theta), a*x-b*y, b*x+a*y


def log_pose(pose):
    c, s, x, y = pose
    theta = atan2(s, c)
    if theta == -pi:
        theta = pi
    a, b = coefficients(theta)
    d = a*a+b*b
    return ((a*x+b*y)/d, (-b*x+a*y)/d), theta


def pair(v):
    return '(' + ', '.join(
        f'{0.0 if abs(x)<0.5e-6 else x:.6f}' for x in v
    ) + ')'


for degrees in [0, 90, -180, 270, 360]:
    pose = exp_pose((1.0, 0.0), radians(degrees))
    rho_log, theta_log = log_pose(pose)
    recovered = exp_pose(rho_log, theta_log)
    assert hypot(recovered[2]-pose[2], recovered[3]-pose[3]) < 1e-12
    assert hypot(recovered[0]-pose[0], recovered[1]-pose[1]) < 1e-12
    angle = theta_log*180/pi
    if abs(angle)<0.5e-3:
        angle = 0.0
    print(f'{degrees:4d} deg: translation={pair(pose[2:])}')
    print(f'  log rho={pair(rho_log)}, angle={angle:.3f} deg')

Expected output:

   0 deg: translation=(1.000000, 0.000000)
  log rho=(1.000000, 0.000000), angle=0.000 deg
  90 deg: translation=(0.636620, 0.636620)
  log rho=(1.000000, 0.000000), angle=90.000 deg
-180 deg: translation=(0.000000, -0.636620)
  log rho=(-1.000000, 0.000000), angle=180.000 deg
 270 deg: translation=(-0.212207, 0.212207)
  log rho=(-0.333333, 0.000000), angle=-90.000 deg
 360 deg: translation=(0.000000, 0.000000)
  log rho=(0.000000, 0.000000), angle=0.000 deg

This example accepts poses produced by its own exponential. Code that accepts external matrices also needs to check rotation and homogeneous-row constraints before applying this SE(2) logarithm.

Try it yourself

Exercise 1. Use ρ = (0, 1) m and θ = π/2. Find the endpoint translation. Then use the chosen logarithm to recover ρ. Explain why putting (0, 1) directly in the pose's translation column would describe a different motion.

Show solution 1

Here A = B = 2/π. Multiplying V by ρ gives p = (−2/π, 2/π) m, about (−0.636620, 0.636620) m. The positive body-y direction turns toward negative world x during the motion.

The chosen angle is π/2. Substituting p into the two logarithm formulas gives ρ_log,x = 0 and ρ_log,y = 1. A translation column of (0, 1) would place the body origin elsewhere, even if its final heading were the same.

Exercise 2. A constant body twist has ρ = (1, 0) m and θ = 2π. What are its final pose and chosen logarithm? At s = 0.5, where is the body origin, and which way does its body x-axis point?

Show solution 2

The final pose is identity because R(2π) = I and V(2π) = 0. The chosen logarithm is ρ_log = (0, 0), φ = 0, so it cannot recover the original coordinates.

At halfway, exponentiate ρ/2 = (0.5, 0) and θ/2 = π. The translation is (0, 1/π) m, about (0, 0.318310) m. Its body x-axis points along negative world x.

The original motion has changed both position and orientation at halfway. The zero-log path stays at identity throughout. Their equal endpoints do not imply equal paths.

Sources and further study