Robot arm: forward and inverse kinematics
A robot arm is a chain of links joined by motors, from a fixed base to a tool (the end effector). Programming it requires going back and forth between the motor angles and the position of the tool: that is forward and inverse kinematics. The 3D robot arm tool does it with the Denavit–Hartenberg convention, the one used in robotics courses.
Joints and degrees of freedom
Each joint of a serial arm is a revolute (R, it turns) or a prismatic one (P, it slides), and contributes one degree of freedom. To put the tool at any point in space you need 3; to also orient it as you wish, 6. That is why industrial arms have 6 joints: three to bring the wrist into place and three (the spherical wrist) to orient the tool.
| Configuration | Joints | Typical use |
|---|---|---|
| Cartesian (gantry) | PPP | 3D printers, CNC machines, palletizing |
| SCARA | RRPR | fast assembly on a table |
| Anthropomorphic | RRR | base, shoulder and elbow, like a human arm |
| 6R with a spherical wrist | RRRRRR | welding, painting, general handling |
Denavit–Hartenberg parameters
To chain the joints together, a frame is attached to each one, with the axis along the axis of rotation (or sliding). The Denavit–Hartenberg convention describes the step from one frame to the next with just four numbers:
| Parameter | What it measures | Variable if… |
|---|---|---|
| rotation about | the joint is R | |
| offset along | the joint is P | |
| length of the common normal (along the new ) | — | |
| twist between and about | — |
It is a 4 × 4 homogeneous matrix: its 3 × 3 block is a rotation and its last column, a translation. Multiplying them in order gives the pose of the tool relative to the base:
Forward kinematics
From the motor angles you get the position of the tool: it is just multiplying matrices. In the planar two-link arm, the product reduces to adding the two vectors:
Inverse kinematics
The opposite problem, which angles put the tool at a given point, is harder: it is nonlinear and may have several solutions or none. In the 2R it is solved with the law of cosines:
- If , the point is outside the workspace (the ring between and ).
- If it is inside, there are two solutions, : elbow up and elbow down.
- For general arms there is not always a formula: it is solved numerically, correcting the angles with the Jacobian until the position error vanishes. The simulator uses Levenberg–Marquardt and starts from the current pose, so it finds the solution closest to it.
Jacobian and singularities
The Jacobian relates the motor velocities to that of the tool: , . Each column comes from the geometry: for an R joint, and ; for a P joint, .
When its columns become dependent, the arm is at a singularity: there are directions in which the tool cannot move however fast the motors turn, and near them the required joint velocities blow up. In the 2R:
The manipulability measures how far you are from a singularity (with fewer than three joints is used, which in the 2R is ). The Jacobian also gives the static torques: to hold a force at the tool you need .
Trajectories
A robot does not jump from one pose to another: each joint follows a motion law that starts and stops smoothly. Moving each joint from its start to its end value with the fifth-degree polynomial (), the velocity and acceleration start and end at zero. If the tool must follow a line or a circle in space, inverse kinematics is solved at every instant of the path.
Common mistakes
- Mixing classic and modified DH, or multiplying the matrices in the reverse order.
- Measuring from the axis instead of from the extension of the first link.
- Using instead of : the quadrant is lost.
- Keeping a single inverse-kinematics solution without looking at the joint limits (the other one may be the only feasible one).
- Multiplying the Jacobian by velocities in °/s: the columns of R joints need rad/s.
Worked examples
Example 1Forward kinematics and Jacobian of a 2R arm
Solution
- . Position: m; m.
- Differentiating and with respect to and : .
- Notice that the first column is : turning the base moves the tool perpendicular to the line joining it to the base.
- m²: far from a singularity.
Solve it in Simuveliq
- The button opens the 2R arm stopped at , (in Engineering → 3D robot arm, the «Planar 2R» example is the same arm, but moving).
- The End-effector position card gives 0.537, 0.636, 0 m and Manipulability 0.141 m². In «Forward kinematics step by step», the matrix has the position (0.5365, 0.6364, 0) in its last column and the «Jacobian and velocities» block the two columns above.
- Change to 0° in Home position and limits: the manipulability drops to 0 and «near a singularity» appears.
Example 2Denavit–Hartenberg of an anthropomorphic arm
Solution
- raises the shoulder height () and, with , makes axis horizontal: joints 2 and 3 turn in a vertical plane that the base orients with .
- In that plane it works like a 2R: horizontal reach m and height m.
- The base turns the plane by : m and m. It is the last column of .
Solve it in Simuveliq
- The button opens the 3R anthropomorphic arm stopped at that pose. The Denavit–Hartenberg parameters table has , , and .
- «Forward kinematics step by step» shows the table with the angles of the instant, each and with the position (0.6317, 0.3647, 0.5214) in its last column; the End-effector position card gives the same.
Example 3Inverse kinematics of the 2R arm
Solution
- Distance to the point: m², inside the ring from 0.1 to 0.9 m.
- .
- With : (elbow down).
- With : (elbow up). Both are valid; the robot chooses depending on where it starts from and on its limits.
Solve it in Simuveliq
- The button opens the arm with the Point to point (joint space) motion toward (0.6, 0.3, 0), stopped at the end of the move.
- It starts from (30°, 45°), so the numerical method reaches the nearest solution: the «Forward kinematics step by step» table shows and , and the tool at (0.6, 0.3, 0).
- Change the home position to and you will see it get there the other way, elbow up.