Inverse kinematics solutions
Why a position has up to 8 or 16 joint solutions on a Yaskawa robot, what they look like, which positions are reachable, and how to choose a solution.
This page explains the inverse kinematics of the Yaskawa SDK in detail: why one position has several joint solutions, how the solutions of a GP7 and of an HC10 look, and how to choose the solution to send to the robot. The computation is offline and works for the 169 models of the catalog.
Several solutions for one position
A 6-axis arm reaches most positions with several postures. InverseKinematics returns all of them:
- Front or back: the S axis turns the arm toward the target, or the opposite way and the arm reaches over its base.
- Elbow up or elbow down: the U axis is above or below the line from the L axis to the wrist.
- Wrist flip: the R axis turns by 180 degrees, the B axis changes its sign. The flange has the same position.
These 3 choices give up to 8 solutions for a robot with a spherical wrist (GP7, MH, ES...). The example of the snippet below gives 8 solutions for a GP7:
static void Main(){DhParameters dh = DhParameters.FromArmKinematicModel(ArmKinematicModels.GP7);// Flange position in the robot frame: mm and degreesvar target = new CartesianPosition(400, 100, 300, 180, 0, 0);// Every joint solution, angles in (-180, 180]. Empty if the position cannot be reached.JointsAngles[] solutions = KinematicsUtils.InverseKinematics(target, dh);foreach (JointsAngles solution in solutions)Console.WriteLine(solution); // S=..., L=..., U=..., R=..., B=..., T=...}}
A cobot with a wrist offset along the B axis (HC10, HC10DT, HC20SDT) has more solutions, up to 16, because the offset of the wrist adds other ways to place the arm.
Reachable positions
The number of solutions changes with the position. The map below counts the solutions in the vertical plane Y = 0, with the flange pointing down:
- Outside the reach of the arm, the array is empty.
- At the border of the reach, the elbow is straight and some solutions merge.
- For the HC10, the flange cannot be on the S axis with the flange pointing down: the wrist offset of 162 mm keeps it away.
The joint limits are not applied: a part of these solutions is outside the limits of the real robot.
Choose a solution
Closest to the current position
To move the robot with the smallest joint motion, keep the solution closest to the current joint angles. The snippet below keeps the solution with the smallest largest joint move:
DhParameters dh = DhParameters.FromArmKinematicModel(ArmKinematicModels.GP7);var target = new CartesianPosition(400, 100, 300, 180, 0, 0);// The current joint angles of the robot, in degreesvar current = new JointsAngles(10, 20, -10, 0, -60, 0);// Keep the solution with the smallest joint moveJointsAngles best = null;double bestDistance = double.MaxValue;foreach (JointsAngles solution in KinematicsUtils.InverseKinematics(target, dh)){double distance = 0;for (int i = 0; i < 6; i++)distance = Math.Max(distance, Math.Abs(solution.Values[i] - current.Values[i]));if (distance < bestDistance){best = solution;bestDistance = distance;}}Console.WriteLine(best == null ? "Not reachable" : $"{best}, largest joint move {bestDistance:F1} deg");}}
Other criteria
- Joint limits: remove the solutions outside the limits of your robot (from its data sheet or from the soft limits of the controller).
- Posture: keep the front and elbow up solutions to stay in the same posture along a path.
- Wrist singularity: a B angle close to 0 makes the R and T axes aligned. Prefer the solutions far from it for linear moves.
Errors
InverseKinematicsreturns an empty array when the position cannot be reached. It does not throw.- It throws a
NotSupportedExceptionfor a structure that is not supported. See Supported robots. - It throws an
ArgumentNullExceptionwhen the position or the parameters are null.
Reference
Forward and inverse kinematics of 6-axis Yaskawa arms.
| Member | Type | Description |
|---|---|---|
ForwardKinematics(IJointAngles, IDhParameters) Method static | CartesianPosition | Computes the flange position for the given joint angles.
|
InverseKinematics(ICartesianPosition, IDhParameters) Method static | JointsAngles[] | Computes all the joint solutions that put the flange at the given position. Joint limits are not checked. Angles are returned in the range (-180, 180].
|
Joint angles of a 6-axis arm, in degrees, with the same signs as the pendant (axes S, L, U, R, B, T).
| Member | Type | Description |
|---|---|---|
JointsAngles() Constructor | Initializes a new instance of JointsAngles with all angles at 0. | |
JointsAngles(double, double, double, double, double, double) Constructor | Initializes a new instance of JointsAngles with the specified angles (degrees).
| |
JointsAngles(double[]) Constructor | Initializes a new instance of JointsAngles from an array of at least 6 angles (degrees). The array is copied.
| |
B Property | double | B axis angle (degrees). |
L Property | double | L axis angle (degrees). |
R Property | double | R axis angle (degrees). |
S Property | double | S axis angle (degrees). |
T Property | double | T axis angle (degrees). |
U Property | double | U axis angle (degrees). |
Values Property read only | double[] | Angles of axes S, L, U, R, B, T in degrees. |
ToString() Method | string |
What to read next
- Kinematics models: the DH parameters of your robot.
- Move the robot from a PC: send the target to the robot.