# Paden–Kahan subproblems

Paden–Kahan subproblems are a set of solved geometric problems which occur frequently in inverse kinematics of common robotic manipulators. Although the set of problems is not exhaustive, it may be used to simplify inverse kinematic analysis for many industrial robots. Beyond the three classical subproblems several others have been proposed.

## Simplification strategies

For a structure equation defined by the product of exponentials method, Paden–Kahan subproblems may be used to simplify and solve the inverse kinematics problem. Notably, the matrix exponentials are non-commutative.
Generally, subproblems are applied to solve for particular points in the inverse kinematics problem (e.g., the intersection of joint axes) in order to solve for joint angles.

### Eliminating revolute joints

Simplification is accomplished by the principle that a rotation has no effect on a point lying on its axis. For example, if the point p{\textstyle p} is on the axis of a revolute twist ξ{\textstyle \xi }, its position is unaffected by the actuation of the twist. To wit:$e^{{\widehat {\xi }}\theta }p=p$
Thus, for a structure equation$e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}e^{{\widehat {\xi }}_{3}\theta _{3}}=g$where ξ$_1${\textstyle \xi _{1}}, ξ$_2${\textstyle \xi _{2}} and ξ$_3${\textstyle \xi _{3}} are all zero-pitch twists, applying both sides of the equation to a point p{\textstyle p} which is on the axis of ξ$_3${\textstyle \xi _{3}} (but not on the axes of ξ$_1${\textstyle \xi _{1}} or ξ$_2${\textstyle \xi _{2}}) yields$e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}e^{{\widehat {\xi }}_{3}\theta _{3}}p=gp$By the cancellation of ξ$_3${\textstyle \xi _{3}}, this yields$e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}p=gp$which, if ξ$_1${\textstyle \xi _{1}} and ξ$_2${\textstyle \xi _{2}} intersect, may be solved by Subproblem 2.

### Norm

In some cases, the problem may also be simplified by subtracting a point from both sides of the equation and taking the norm of the result.
For example, to solve$e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}e^{{\widehat {\xi }}_{3}\theta _{3}}=g$for ξ$_3${\textstyle \xi _{3}}, where ξ$_1${\textstyle \xi _{1}} and ξ$_2${\textstyle \xi _{2}} intersect at the point q{\textstyle q}, both sides of the equation may be applied to a point p{\textstyle p} that is not on the axis of ξ$_3${\textstyle \xi _{3}}. Subtracting q{\textstyle q} and taking the norm of both sides yields${\begin{aligned}\delta _{i}=\|gp-q\|=\|e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}e^{{\widehat {\xi }}_{3}\theta _{3}}p-q\|=\|e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}(e^{{\widehat {\xi }}_{3}\theta _{3}}p-q)\|=\|e^{{\widehat {\xi }}_{3}\theta _{3}}p-q\|\end{aligned}}$ This may be solved using Subproblem 3.

## List of subproblems

Each subproblem is presented as an algorithm based on a geometric proof. Code to solve a given subproblem, which should be written to account for cases with multiple solutions or no solution, may be integrated into inverse kinematics algorithms for a wide range of robots.

## Subproblem 1: Rotation about a single axis

    An illustration of the first Paden–Kahan subproblem.Let ξ{\textstyle \xi } be a zero-pitch twist with unit magnitude and p, q∈R$^3${\textstyle p, q\in \mathbb {R} ^{3}} be two points. Find θ{\textstyle \theta } such that $e^{{\widehat {\xi }}\theta }p=q.$
In this subproblem, a point p{\textstyle p} is rotated around a given axis ξ{\textstyle \xi } such that it coincides with a second point q{\textstyle q}.

### Solution

Let r{\textstyle r} be a point on the axis of ξ{\textstyle \xi }. Define the vectors u=(p−r){\textstyle u=(p-r)} and v=(q−r){\textstyle v=(q-r)}. Since r{\textstyle r} is on the axis of ξ{\textstyle \xi }, e$^{ξ^θ}$r=r.{\textstyle e^{{\widehat {\xi }}\theta }r=r.} Therefore, e$^{ω^θ}$u=v.{\textstyle e^{{\widehat {\omega }}\theta }u=v.}
Next, the vectors u$^′${\textstyle u'} and v$^′${\textstyle v'} are defined to be the projections of u{\textstyle u} and v{\textstyle v} onto the plane perpendicular to the axis of ξ{\textstyle \xi }. For a vector ω∈R{\textstyle \omega \in \mathbb {R} } in the direction of the axis of ξ{\textstyle \xi },$u'=u-\omega \omega ^{T}u$and$v'=v-\omega \omega ^{T}v.$In the event that u$^′$=0{\textstyle u'=0}, p=q{\textstyle p=q} and both points lie on the axis of rotation. The subproblem therefore yields an infinite number of possible solutions in that case.
In order for the problem to have a solution, it is necessary that the projections of u{\textstyle u} and v{\textstyle v} onto the ω{\textstyle \omega } axis and onto the plane perpendicular to ω{\textstyle \omega } have equal lengths. It is necessary to check, to wit, that:$\omega ^{T}u=\omega ^{T}v$and that$\|u'\|=\|v'\|$
If these equations are satisfied, the value of the joint angle θ{\textstyle \theta } may be found using the atan2 function:$\theta =\mathrm {atan2} (\omega ^{T}(u'\times v'),u'^{T}v').$Provided that u$^′$≠0{\textstyle u'\neq 0}, this subproblem should yield one solution for θ{\textstyle \theta }.

## Subproblem 2: Rotation about two subsequent axes

    Illustration of Paden–Kahan Subproblem 2. The subproblem yields two solutions in the event that the circles intersect at two points; one solution if the circles are tangential; and no solution if the circles fail to intersect.Let ξ$_1${\textstyle \xi _{1}} and ξ$_2${\textstyle \xi _{2}} be two zero-pitch twists with unit magnitude and intersecting axes. Let p, q∈R$^3${\textstyle p, q\in \mathbb {R} ^{3}} be two points. Find θ$_1${\textstyle \theta _{1}} and θ$_2${\textstyle \theta _{2}} such that $e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}p=q.$
This problem corresponds to rotating p{\textstyle p} around the axis of ξ$_2${\textstyle \xi _{2}} by θ$_2${\textstyle \theta _{2}}, then rotating it around the axis of ξ$_1${\textstyle \xi _{1}} by θ$_1${\textstyle \theta _{1}}, so that the final location of p{\textstyle p} is coincident with q{\textstyle q}. (If the axes of ξ$_1${\textstyle \xi _{1}} and ξ$_2${\textstyle \xi _{2}} are coincident, then this problem reduces to Subproblem 1, admitting all solutions such that θ$_1$+θ$_2$=θ{\textstyle \theta _{1}+\theta _{2}=\theta }.)

### Solution

Provided that the two axes are not parallel (i.e., ω$_1$≠ω$_2${\textstyle \omega _{1}\neq \omega _{2}}), let c{\textstyle c} be a point such that $e^{{\widehat {\xi }}_{2}\theta _{2}}p=c=e^{-{\widehat {\xi }}_{1}\theta _{1}}q.$ In other words, c{\textstyle c} represents the point to which p{\textstyle p} is rotated around one axis before it is rotated around the other axis to be coincident with q{\textstyle q}. Each individual rotation is equivalent to Subproblem 1, but it's necessary to identify one or more valid solutions for c{\textstyle c} in order to solve for the rotations.
Let r{\textstyle r} be the point of intersection of the two axes:$e^{{\widehat {\xi }}_{2}\theta _{2}}(p-r)=c-r=e^{-{\widehat {\xi }}_{1}\theta _{1}}(q-r).$
Define the vectors u=(p−r){\textstyle u=(p-r)}, v=(q−r){\textstyle v=(q-r)} and z=(c−r){\textstyle z=(c-r)}. Therefore,$e^{{\widehat {\xi }}_{2}\theta _{2}}u=z=e^{-{\widehat {\xi }}_{1}\theta _{1}}v.$
This implies that ω$_2$$^T$u=ω$_2$$^T$z{\textstyle \omega _{2}^{T}u=\omega _{2}^{T}z}, ω$_1$$^T$v=ω$_1$$^T$z{\textstyle \omega _{1}^{T}v=\omega _{1}^{T}z}, and ‖u‖$^2$=‖z‖$^2$=‖v‖$^2${\textstyle \|u\|^{2}=\|z\|^{2}=\|v\|^{2}}. Since ω$_1${\textstyle \omega _{1}}, ω$_2${\textstyle \omega _{2}} and ω$_1$×ω$_2${\textstyle \omega _{1}\times \omega _{2}} are linearly independent, z{\textstyle z} can be written as$z=\alpha \omega _{1}+\beta \omega _{2}+\gamma (\omega _{1}\times \omega _{2}).$
The values of the coefficients may be solved thus:
$\alpha ={\frac {(\omega _{1}^{T}\omega _{2})\omega _{2}^{T}u-\omega _{1}^{T}v}{(\omega _{1}^{T}\omega _{2})^{2}-1}}$$\beta ={\frac {(\omega _{1}^{T}\omega _{2})\omega _{1}^{T}v-\omega _{2}^{T}u}{(\omega _{1}^{T}\omega _{2})^{2}-1}}$, and$\gamma ^{2}={\frac {\|u\|^{2}-\alpha ^{2}-\beta ^{2}-2\alpha \beta \omega _{1}^{T}\omega _{2}}{\|\omega _{1}\times \omega _{2}\|^{2}.}}$The subproblem yields two solutions in the event that the circles intersect at two points; one solution if the circles are tangential; and no solution if the circles fail to intersect.

## Subproblem 3: Rotation to a given distance

    Let ξ{\textstyle \xi } be a zero-pitch twist with unit magnitude; let p, q∈R$^3${\textstyle p, q\in \mathbb {R} ^{3}} be two points; and let δ{\textstyle \delta } be a real number greater than 0. Find θ{\textstyle \theta } such that $\|q-e^{{\widehat {\xi }}\theta }p\|=\delta .$
In this problem, a point p{\textstyle p} is rotated about an axis ξ{\textstyle \xi } until the point is a distance δ{\textstyle \delta } from a point q{\textstyle q}. In order for a solution to exist, the circle defined by rotating p{\textstyle p} around ξ{\textstyle \xi } must intersect a sphere of radius δ{\textstyle \delta } centered at q{\textstyle q}.

### Solution

Let r{\textstyle r} be a point on the axis of ξ{\textstyle \xi }. The vectors u=(p−r){\textstyle u=(p-r)} and v=(q−r){\textstyle v=(q-r)} are defined so that$\|v-e^{{\widehat {\xi }}\theta }u\|^{2}=\delta ^{2}.$
The projections of u{\textstyle u} and v{\textstyle v} are u$^′$=u−ωω$^T$u{\textstyle u'=u-\omega \omega ^{T}u} and v$^′$=v−ωω$^T$v.{\textstyle v'=v-\omega \omega ^{T}v.} The “projection” of the line segment defined by δ{\textstyle \delta } is found by subtracting the component of p−q{\textstyle p-q} in the ω{\textstyle \omega } direction:$\delta '^{2}=\delta ^{2}-|\omega ^{T}(p-q)|^{2}.$The angle θ$_0${\textstyle \theta _{0}} between the vectors u$^′${\textstyle u'} and v$^′${\textstyle v'} is found using the atan2 function:$\theta _{0}=atan2(\omega ^{T}(u'\times v'),u'^{T}v').$The joint angle θ{\textstyle \theta } is found by the formula$\theta =\theta _{0}\pm \cos ^{-1}\left({\frac {\|u'\|^{2}+\|v'\|^{2}-\delta '^{2}}{2\|u'\|\|v'\|}}\right).$This subproblem may yield zero, one, or two solutions, depending on the number of points at which the circle of radius ‖u$^′$‖{\textstyle \|u'\|} intersects the circle of radius δ$^′${\textstyle \delta '}.

## Subproblem 4: Rotation about two axes to a given distance

    Let ξ$_1${\textstyle \xi _{1}} and ξ$_2${\textstyle \xi _{2}} be two zero-pitch twists with unit magnitude and intersecting axes. Let p, q$_1$, q$_2$∈R$^3${\textstyle p, q_{1}, q_{2}\in \mathbb {R} ^{3}} be points. Find θ$_1${\textstyle \theta _{1}} and θ$_2${\textstyle \theta _{2}} such that $\|e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}p-q_{1}\|=\delta _{1}$ and $\|e^{{\widehat {\xi }}_{1}\theta _{1}}e^{{\widehat {\xi }}_{2}\theta _{2}}p-q_{2}\|=\delta _{2}.$
This problem is analogous to Subproblem 2, except that the final point is constrained by distances to two known points.

## Subproblem 5: Translation to a given distance

    Let ξ{\textstyle \xi } be an infinite-pitch unit magnitude twist; p, q∈R$^3${\textstyle p, q\in \mathbb {R} ^{3}} two points; and δ{\textstyle \delta } a real number greater than 0. Find θ{\textstyle \theta } such that $\|q-e^{{\widehat {\xi }}\theta }p\|=\delta .$