explainer
Configuration space: follow joint paths across angle boundaries
Represent a robot arm as a point in joint space, follow paths across periodic angle boundaries, and distinguish angular distance from workspace motion and collision clearance.
What you will learn
- Represent an ideal two-joint arm as one point in a two-dimensional configuration space.
- Explain why opposite edges of its angle square identify the same configurations.
- Calculate raw and shortest wrapped joint paths with an explicit half-turn convention.
- Separate joint-angle distance from tool displacement and collision-free motion.
- Construct the configuration-space obstacle for a translating disk.
Before you start
A joint at 170° can reach the orientation labeled −170° by turning 20° counterclockwise. Subtracting the displayed numbers gives −340°, which requests a much longer turn. The robot's geometry identifies angle labels separated by a full revolution.
Configuration space, or C-space, organizes the configurations a robot can take. For our ideal two-joint arm, it also tells us how to compare nearby angles, join configurations into paths, and describe the configurations that collide with obstacles.
Describe the whole arm with one point
Use a fixed-base planar arm with link lengths L₁ = 2 m and L₂ = 1 m. World x points right, y points up, and positive angles turn counterclockwise. Shoulder angle θ₁ is absolute; elbow angle θ₂ measures rotation relative to the first link.
The pair q = (θ₁, θ₂) determines both links' positions. We can therefore represent the entire arm configuration with one point in a two-dimensional space of joint coordinates. A point in that space carries enough information to reconstruct the arm through forward kinematics.
The tool position uses a different pair of coordinates:
p(q) = (2 cos θ₁ + cos(θ₁ + θ₂),
2 sin θ₁ + sin(θ₁ + θ₂)) m
Several configurations can share a tool position. The analytical IK lesson gives q_A = (0°, 90°) and q_B ≈ (53.130102°, −90°), both reaching (2, 1) m. Their elbows occupy (2, 0) m and (1.2, 1.6) m, so the complete arms differ.
A tool target alone therefore does not specify the configuration. The robot workspace describes outputs of a chosen task map; configuration space describes the robot configurations that produce them.
Give each unrestricted joint a circle
Assume each joint can rotate freely and that we care about its orientation modulo full turns. One joint then has the topology of a circle, written S¹. Its labels 0°, 360°, and −360° all identify the same orientation.
Two independent revolute-joint orientations give the product:
C = S¹ × S¹ = T²
Each circle contributes one local coordinate, so this configuration space has dimension two. A familiar doughnut surface illustrates the topology of a torus. The robot itself remains a two-link arm in a plane.
Modern Robotics develops this torus model for the 2R robot. It also shows why a flat coordinate display needs cuts to represent periodic joint orientations.
Our model omits joint stops and winding history. A mechanical stop can restrict an angle to an interval. A cable or multi-turn mechanism can require tracking accumulated rotation, making configurations with the same geometric orientation different physical states.
Read the square without mistaking its cuts for stops
Choose angle labels in [−180°, 180°) for each joint. A square displays the two coordinates, with θ₁ horizontal and θ₂ vertical. To recover the torus, identify the left edge with the right edge and the bottom edge with the top edge.
For example, (180°, 30°) and (−180°, 30°) describe the same configuration. The four corner labels also identify one configuration because either joint can change its label by 360° independently.
This display has a coordinate seam. A continuously increasing shoulder angle can pass through 179°, 180°, 181°, while its normalized labels read 179°, −180°, −179°. Only the labels jump.
The whole square does not provide one continuous global coordinate chart across its cuts. Locally, a small region of the torus still behaves like an ordinary two-dimensional coordinate patch. The manifold and tangent-space lesson explains that local perspective.
A plotted path must respect the identified edges. When a segment reaches the right boundary, its continuation can start at the paired point on the left boundary. Drawing a line across the square between those two labels would depict extra intermediate configurations that the short path never visits.
Compare raw and wrapped interpolation
Let q_start and q_goal contain the chosen angle representatives. Raw-coordinate interpolation uses their direct difference:
Δq_raw = q_goal − q_start
q̃(u) = q_start + uΔq, 0 ≤ u ≤ 1
The tilde marks a lifted angle path: a continuous choice of real angle values along the motion. These values can continue beyond the display interval. Applying the wrap function to each coordinate produces the chart labels.
For shortest wrapped interpolation, choose each difference in [−180°, 180°):
Δq_wrap,i = wrap(q_goal,i − q_start,i)
q_chart(u) = wrap(q_start + uΔq_wrap)
Adding full turns to an endpoint label can change the raw path. The wrapped difference preserves the represented orientation difference. This makes it useful when the configuration model identifies those turns.
At exactly 180° separation, positive and negative half-turns have equal length. Our convention chooses −180° for the wrapped difference. A joint-angle metric alone cannot choose a uniquely preferred direction in this tie.
Define the metric behind shortest
We choose a flat product metric that gives both joint angles equal weight. With angles in radians, a small joint displacement has length √(dθ₁² + dθ₂²). The corresponding shortest distance between configurations is:
d(q, r) = min over k ∈ ℤ² of ‖r − q + 2πk‖₂
d(q, r) = ‖wrap(r − q)‖₂
Here wrap uses [−π, π), the radian form of our display convention. Each integer component of k chooses how many full turns to add. Minimizing the squared Euclidean norm lets each coordinate choose a shortest angular difference.
A straight lifted path with that difference achieves the distance. Any lifted path joining the same endpoint representatives has length at least their straight-line displacement. This establishes the shortest-path claim for the stated metric and an obstacle-free torus.
Steven LaValle discusses circle and product-space metrics in Planning Algorithms, including the role of joint weights. Our metric is a declared choice; it does not inherit distances from a doughnut surface drawn in three-dimensional space.
Joint-angle length uses radians. It does not measure tool travel in meters, elapsed time, energy, or clearance. Choosing another cost or adding obstacles can change which path we want.
Periodic coordinates also matter in machine learning. A nearest-neighbor comparison of raw degree labels can treat 179° and −179° as far apart. Wrapped differences, or periodic features such as (cos θ, sin θ), encode their close orientations; the feature representation still needs a distance choice and does not retain winding history.
Move from 170 degrees to minus 170 degrees
Take q_start = (170°, 30°) and q_goal = (−170°, 30°). The elbow stays fixed. Direct subtraction and wrapping give:
- Raw difference: (−340°, 0°).
- Shortest wrapped difference: (20°, 0°).
- Raw path length: 340π/180 ≈ 5.934119 rad.
- Wrapped path length: 20π/180 ≈ 0.349066 rad.
At u = 1/2, the raw path reaches q = (0°, 30°). Its tool is at (2 + √3/2, 1/2) ≈ (2.866025, 0.500000) m.
The wrapped lift reaches (180°, 30°), displayed as (−180°, 30°). Its tool is at (−2 − √3/2, −1/2) ≈ (−2.866025, −0.500000) m. Both paths reach the same goal configuration, but their intermediate arm configurations differ substantially.
In the coordinate square, the wrapped route has two pieces: (170°, 30°) to (180°, 30°), followed by (−180°, 30°) to (−170°, 30°). The two seam endpoints identify the same physical arm. Their separation on the page contributes no extra angular travel.
Follow the same path in two views
Start with Shoulder seam and move the fraction slider across u = 0.5. The chart marker crosses its paired edges while the arm view changes continuously. Compare the lifted and chart-angle readouts to locate the seam.
Switch Joint interpolation to Raw coordinates at the midpoint. The physical arm swings to the opposite side of the shoulder because this path takes the long turn. The two full paths stay visible in the coordinate plot for comparison.
Other presets expose separate ideas:
- Two seams crosses both coordinate boundaries at the same fraction. The chart continuation goes from one corner to its identified opposite corner.
- Same tip, different joints gives matching endpoint tool positions but distinct arm configurations. The interpolated tool leaves that shared position between the endpoints.
- Half-turn tie compares two equal-length directions around the shoulder circle.
- Equivalent angles gives identical endpoint configurations. Wrapped interpolation stays still; raw interpolation requests a full turn.
- No seam gives an example where both interpolation rules agree.
The fraction u specifies progress, without a clock. A trajectory time scaling can later assign a duration and joint rates. These arm plots omit obstacles, joint stops, and collision checks.
Turn body collisions into forbidden configurations
Let A(q) denote the region occupied by the whole robot at configuration q, and let O denote the obstacle region in world coordinates. Count touching as collision. The forbidden configurations and free configurations are:
C_obs = {q ∈ C : A(q) ∩ O ≠ ∅}
C_free = C ∖ C_obs
A free path must remain in C_free for every value of u. A collision-free start and goal alone do not establish that property. Modern Robotics shows how workspace obstacles create regions of forbidden joint configurations, including regions connected through the square's paired edges.
For a simpler construction, replace the arm with a disk of radius 0.3 m that only translates. Its configuration is its center (x, y), so C = ℝ². A circular obstacle of radius 0.4 m creates a forbidden disk of radius 0.7 m around the obstacle center.
This construction expands the obstacle by the robot's radius. In set notation it is the Minkowski sum O ⊕ D₀.₃, where D₀.₃ is a disk centered at zero. LaValle derives the general translational construction as the obstacle plus the reflected robot shape; a centered disk equals its reflection.
For an obstacle centered at (2, 1) m, the forbidden centers satisfy (x − 2)² + (y − 1)² ≤ 0.7² m², with coordinate values expressed in meters. Tangency belongs to C_obs under our contact convention. A center farther than 0.7 m away clears this one obstacle in the stated disk model.
For an arm, testing only its tip can miss collisions involving a link. Testing only sampled configurations can also miss a collision between samples. The collision-checking lesson turns the free-space requirement into explicit geometric and path checks. Once valid configurations and connections form a graph, Dijkstra's algorithm can find its lowest-cost route.
Reproduce both interpolations in Python
This standard-library example computes the two midpoint configurations, their forward positions, and their angular path lengths. The wrap function chooses the same half-open interval and negative half-turn tie as the experiment. Six-decimal formatting suppresses negative zero.
from math import cos, fmod, hypot, pi, radians, sin
def wrap(angle):
angle = fmod(angle, 360)
if angle >= 180:
angle -= 360
if angle < -180:
angle += 360
return 0.0 if angle == 0 else angle
def tool(angles):
a, b = (radians(wrap(value)) for value in angles)
return (2 * cos(a) + cos(a + b), 2 * sin(a) + sin(a + b))
def pair(values):
return "(" + ", ".join(
f"{0.0 if abs(value) < 0.0000005 else value:.6f}"
for value in values
) + ")"
start, goal = (170, 30), (-170, 30)
u = 0.5
raw = tuple(b - a for a, b in zip(start, goal))
wrapped = tuple(wrap(value) for value in raw)
print("start tool (m):", pair(tool(start)))
print("goal tool (m): ", pair(tool(goal)))
for name, delta in [("raw", raw), ("wrapped", wrapped)]:
lifted = tuple(a + u * d for a, d in zip(start, delta))
chart = tuple(wrap(value) for value in lifted)
length = hypot(*delta) * pi / 180
print(f"{name}: delta_deg={pair(delta)}")
print(f" lifted_deg={pair(lifted)}; chart_deg={pair(chart)}")
print(f" midpoint_tool_m={pair(tool(chart))}")
print(f" joint_path_length_rad={length:.6f}")
Expected output:
start tool (m): (-2.909308, 0.005276)
goal tool (m): (-2.735660, -0.990084)
raw: delta_deg=(-340.000000, 0.000000)
lifted_deg=(0.000000, 30.000000); chart_deg=(0.000000, 30.000000)
midpoint_tool_m=(2.866025, 0.500000)
joint_path_length_rad=5.934119
wrapped: delta_deg=(20.000000, 0.000000)
lifted_deg=(180.000000, 30.000000); chart_deg=(-180.000000, 30.000000)
midpoint_tool_m=(-2.866025, -0.500000)
joint_path_length_rad=0.349066
Change the endpoints to (180, 30) and (−180, 30). The wrapped length becomes zero, while the raw path length becomes 2π rad. This verifies that endpoint distance and the length of a chosen route answer different questions.
Try it yourself
Exercise 1. Use start (170°, 170°) and goal (−170°, −170°). Find the raw and wrapped differences, their path lengths under our metric, and their midpoint arm configurations. Where is the tool at each midpoint?
Show the two-seam solution
The raw difference is (−340°, −340°), with length 340√2 π/180 ≈ 8.392112 rad. Its midpoint is (0°, 0°), giving tool position (3, 0) m.
The wrapped difference is (20°, 20°), with length 20√2 π/180 ≈ 0.493654 rad. Its midpoint lift is (180°, 180°), displayed as (−180°, −180°).
At that midpoint the first link points left and contributes (−2, 0) m. The second link points right and contributes (1, 0) m. The tool is at (−1, 0) m, and the two chart-seam crossings occur together at u = 0.5.
Exercise 2. A translating disk robot has radius 0.3 m. A disk obstacle centered at (2, 1) m has radius 0.4 m, and contact counts as collision. Classify robot centers (2.5, 1), (2.7, 1), and (2.8, 1) m. Does a pair of free endpoints prove a whole path is free?
Show the configuration-obstacle solution
The forbidden radius is 0.3 + 0.4 = 0.7 m. The three center distances from the obstacle are 0.5 m, 0.7 m, and 0.8 m.
The first position overlaps the obstacle. The second is tangent and counts as collision. The third is free with respect to this obstacle in the ideal model.
Free endpoints do not certify the intermediate configurations. A path between two free centers can pass through the forbidden disk; the check must account for the whole proposed path.
Sources and further study
- Lynch and Park, Modern Robotics: Configuration Space Topology explains the 2R torus and the cuts in a square coordinate representation.
- Steven M. LaValle, Planning Algorithms: Important Metric Spaces for Motion Planning compares angular and embedding distances and discusses metrics on products of circles.
- Modern Robotics: C-Space Obstacles connects robot-body collisions with forbidden configurations and paths through free space.
- LaValle, Planning Algorithms: The Translational Case derives configuration-space obstacles through the Minkowski sum with a reflected robot shape.
Continue with collision checking to decide whether a proposed configuration or path clears the modeled obstacles.