# Basics on IK groups and IK elements

CoppeliaSim uses IK groups and IK elements to solve inverse and forward kinematics tasks. It is important to understand how an IK task is solved in order to take full advantage of the kinematics functionality in CoppeliaSim. Make sure to have a look at the various example scenes related to IK and FK in folder scenes/kinematics.

An IK task is defined by an IK group, which contains one or more IK elements:

• IK group: an IK group contains one or more IK elements. To solve the kinematics of a simple kinematic chain, one IK group containing one IK element is needed. The IK group defines the overall solving properties (such as the solver, the number of iterations, etc.).
• IK element: an IK element represents a simple kinematic chain, which is a linkage containing at least one joint in IK mode. The chain is specified by a tip, indicating the end-effector (usually the last object in the chain), and a base, indicating the base object (or first object) in the chain, and a target for the tip to follow. In short, an IK element is made up by:
• a base, which represents the start of the kinematic chain.
• several links (any type of object except joints in IK mode). Joints which are not in IK mode are however also considered as links (in that case they behave as rigid joints (joints with a fixed linear/angular position)).
• several joints. which need to be in IK mode, otherwise they are considered as links (see above).
• a tip. The tip is usually the last object in the considered kinematic chain (when going from the base to the tip), and is often the end-effector. The tip object should be linked to a target object (see hereafter).
• a target. The target represents the position and/or orientation the tip should adopt (or follow) when solving for IK. The target object should be linked to a tip object (see hereabove).
• Following figures show two kinematic chains as they are described via IK elements. The two IK elements perceive the two chains in a similar way (the very first joint of the second example is ignored by the IK element):

[Two kinematic chains, each describing an IK element]

The goal of an IK element (i.e. resolution of an IK element) is to have the target followed by the tip (i.e. having tip and target overlap, given certain constraints), by computing the appropriate joint values for the kinematic chain:

[IK element and corresponding model of the IK solving task]

In above example (in 2D for simplicity), we can specify various constraints for the tip-target pair, e.g.:

• X positional constraint: the tip would follow the target only on the X-axis, and the kinematic chain would appear redundant for this task since the chain itself has 3 Degrees of Freedom (DoFs).
• X/Y positional constraints: the tip would follow the target only in position, and the kinematic chain would still appear redundant for this task.
• X/Y positional + Θ orientational constraints: the tip would follow the target in position and orientation, and the kinematic chain would not appear as redundant anymore for this task.
• Note that even for the most basic IK task, an IK element is solved via the resolution of the encompassing IK group.

Two separate kinematic chains are handled in an identical fashion, however this time, two IK groups are needed (and each one of them should contain one IK element for each kinematic chain). Solving order of the two IK groups is usually not important:

[Two separate IK chains and corresponding model of the IK solving tasks]

In above example, should target2 be attached to a mobile part of the first kinematic chain, then the solving order becomes important and the IK group1 should be solved first (solving result will displace target2 as can be seen from following figure):

[Two separate IK chains, where the target of the second chain is attached to the first chain, and corresponding model of the IK solving tasks]

A similar case can appear when one IK element is built on top of another IK element, without sharing any common joint as can be seen from following figure: the first kinematic chain is indicated in black, the second in light blue. Base2, indicated in purple, is the common object between the two chains. Solving IK element2 won't displace the purple link, however solving IK element1 will displace it. For that reason IK group1 has to be solved before IK group2 as in above case (solving order is important):

[Two IK chains sharing one common link but no common joints and corresponding model of the IK solving tasks]

A more difficult case appears when two or more kinematic chains share common joints. In that case sequential solving doesn't work most of the time (in following example, the two IK elements tend to rotate the common joint into opposite directions) and a simultaneous solving method is needed. To simultaneously solve several IK elements, just group them into one common IK group. This case is illustrated in following figure:

[Two IK chains sharing one common joint and corresponding model of the IK solving task]