# KDL Inverse kinematic and initial guess

I am using KDL Inverse Kinematic Solver (LMA) for a kinematic chain of 8 DOF. The problem is that the convergence to solution depends on the initial values. I run the algorithm with many initial values (ca 100 times) to increase the success rate. To generate the initial values I generate database consisting of thousands of joint value and cartesian pose pairs (using forward kinematics) in the neighborhood of my expected workspace. Before running IK, I search the database to get poses closest to the desired cartesian pose and use the paired joint space values as the initial guess. In this way I find a solution for almost all cases, however it is very time consuming.

My questions:

1. Is it a good approach at all to generate such database of (joint space value, cartesian pose) pairs and perform the search?
2. Are there other approaches to mitigate the initial value problem?

Thanks.

Unfortunately, (I think), you are doing the right thing. But maybe there are some games to play...

The nature of IK is that it will give you a set of solutions. (Or maybe in the KDL case it will give you a single solution, based on an initial configuration. But anyways the concept is the same.)

In general, for a perfectly constrained problem, the number of IK solutions grows exponentially with the number of joints. And if you are under-constrained, then the number of IK solutions is infinite. But these infinite solutions form "islands" in configuration space. Take for example this planar 2 link arm:

The two IK solutions (or islands of solutions) are: elbow up, and elbow down. You wouldn't need to feed KDL thousands of initial configurations to get these two solutions. You probably only need to give it an initial configuration close enough to each of these islands.

Optimization 1. Know before-hand what kind of general arm configuration you want.

Sure, this arm configuration is valid for grabbing this flashlight:

But it is awkward and probably not good for the next sequence of actions. You probably want a more "natural" looking arm configuration like this:

Optimization 2. Once you get your single IK solution, it might be possible to use null-space techniques to move the redundant DoF into a better configuration?

• Thanks for the answer. Since I have 8 DOF and the goal pose has 6 DOF, I have redundancy. Further details: I have a preset workspace center (a set of known joint space values that put my robot in the center of workspace). Around this point I generate my database of points, in the hope that my solutions also lie in the same vicinity ( not on other parts of configuration space). Still the database is large and the search and repeated IK algorithm take some time. Oct 4, 2022 at 7:38
• Side note: you might consider some of the metrics described in this question when picking the "best" arm configuration.
– Ben
Oct 4, 2022 at 13:09