Skip to content

Forward and inverse kinematics, frames, rotations

Forward kinematics is used to establish the position of the effector based on the configuration of the robot. The individual angles of the arms are parameters that we know and can control.

Inverse kinematics is used in the case where we need to move the robot’s arm from a starting position that we know, to a final one, for which we need to calculate the new angle values.

In case 𝜑 is not known, inverse kinematics returns 2 possible arm configurations to reach the same point:

𝑞2=±arccos(𝑝𝑥2+𝑝𝑦2−𝑙12−𝑙222𝑙1𝑙2)𝑞1=atan2(𝑝𝑦,𝑝𝑥)−atan2(𝑙2sin(𝑞2),𝑙1+𝑙2cos(𝑞2))

Generally speaking, given a manipulator with 𝑛 joints, a vector of joint variables 𝒒, and the position 𝒑 of the effector:

  • Forward kinematics is about finding 𝒑=𝑓(𝒒);
  • Inverse kinematics is about finding 𝒒=𝑓−1(𝒑)

From now on, we will use the following convention: given reference frame 0, the point 𝒑0′s coordinates will be relative to that reference frame (the superscript denotes the frame).

The same point 𝒑 can of course be associated with different coordinates relative to another reference frame, and in that case it will be denoted 𝒑1.

A frame is uniquely identified by the position of its origin and by the coordinates of the three unit vectors.

Let’s take 2 reference frames, with the same origin and one rotated by an angle 𝛼 with respect to the other.

Rotated frame in blue

We will eventually find that:

𝑝𝑥′=𝑝𝑥cos(𝛼)+𝑝𝑦sin(𝛼)𝑝𝑦′=−𝑝𝑥sin(𝛼)+𝑝𝑦cos(𝛼)

which means:

𝒑′=[cos(𝛼)sin(𝛼)−sin(𝛼)cos(𝛼)]×𝒑

This matrix, which is orthogonal (the columns have unit norm and are mutually orthogonal), is easily invertible, since the transpose is equal to the inverse.

Frame 𝑂, frame 𝑂′ and object 𝒑.

Let’s consider a point belonging to the body. Let 𝒑 be the vector joining the origin 𝟎 with the point in a reference frame with basis {𝒙,𝒚,𝒛}, and 𝒑′ the vector joining 𝟎′ with the point on a reference frame with basis {𝒙′,𝒚′,𝒛′}. Let 𝟎𝟎′ be the vector joining the two origins.

We have:

𝑝𝑥=𝒑⋅𝒙=𝒑′⋅𝒙+𝟎𝟎𝑥′=𝑝𝑥′(𝒙′⋅𝒙)+𝑝𝑦′(𝒚′⋅𝒙)+𝑝𝑧′(𝒛′⋅𝒙)+𝟎𝟎𝑥′𝑝𝑦=𝒑⋅𝒚=𝒑′⋅𝒚+𝟎𝟎𝑦′=𝑝𝑥′(𝒙′⋅𝒚)+𝑝𝑦′(𝒚′⋅𝒚)+𝑝𝑧′(𝒛′⋅𝒚)+𝟎𝟎𝑦′𝑝𝑧=𝒑⋅𝒛=𝒑′⋅𝒛+𝟎𝟎𝑧′=𝑝𝑥′(𝒙′⋅𝒛)+𝑝𝑦′(𝒚′⋅𝒛)+𝑝𝑧′(𝒛′⋅𝒛)+𝟎𝟎𝑧′

Which in more compact form is written:

[𝑝𝑥𝑝𝑦𝑝𝑧]=𝑹[𝑝𝑥′𝑝𝑦′𝑝𝑧′]+[𝟎𝟎𝑥′𝟎𝟎𝑦′𝟎𝟎𝑧′]

where:

𝑹=[𝑥𝑥′𝑦𝑥′𝑧𝑥′𝑥𝑦′𝑦𝑦′𝑧𝑦′𝑥𝑧′𝑦𝑧′𝑧𝑧′]=[𝒙′⋅𝒙𝒚′⋅𝒙𝒛′⋅𝒙𝒙′⋅𝒚𝒚′⋅𝒚𝒛′⋅𝒚𝒙′⋅𝒛𝒚′⋅𝒛𝒛′⋅𝒛]

If we compute 𝑹𝑹𝑇 we obtain 𝐼, which means that 𝑹𝑇=𝑹−1. So the rotation matrix is an orthogonal matrix with det(𝑹)=1 for right-handed frames and det(𝑹)=−1 for left-handed frames.

  • Composing (e.g. multiplying) two rotation matrices produces another rotation matrix.
  • Rotations are associative: 𝑹1(𝑹2𝑹3)=(𝑹1𝑹2)𝑹3
  • Every rotation matrix has a unique inverse matrix.
  • Rotations are not commutative.

SO(3) is the set of all rotation matrices.