orocos / orocos_kinematics_dynamics

Orocos Kinematics and Dynamics C++ library
671 stars 407 forks source link

Question about the computational performance of KDL on redundant kinematic chains #423

Closed zichunxx closed 1 year ago

zichunxx commented 1 year ago

Hi!

I‘ve been learning to use KDL recently and have some confusion.

KDL is developed based on the jacobian pseudo-inverse and theoretically decreases computational efficiency as the degree of freedom (DOF) of the kinematic chain increases.

However, as the comparison results showed in trac-ik, the performance of KDL on a 15-DOF robot arm is better than that on a 7-DOF Kuka arm.

As I understand it, isn't the inverse of the Jacobian matrix more difficult to solve as the DOF increases?

Thanks! Answers would be appreciated!

jrutgeer commented 1 year ago

It says it in the text: "Note on timings: The timings provided include both successful and unsuccessful runs. When an IK solution is not found, the numerical IK solver implementations will run for the full timeout requested, searching for an answer; thus for robot chains where KDL fails much of the time (e.g., Jaco-2), the KDL times are skewed towards the user requested timeout value (here 5 ms)."

In other words: a test with a low success rate has many unsuccessful runs (at 5 ms) and not many successful ones (e.g. at 0,6ms) so the average will be high.

zichunxx commented 1 year ago

@jrutgeer I certainly know what a low success rate means, but that is not the point of opening this issue.

It should be emphasized that my confusion is why the Jacobian-based method would let KDL present better success rates and faster times on long chains.

As I understood it, isn't the Jacobian matrix calculation in the high-dimensional space more computationally expensive?

Thanks!

jrutgeer commented 1 year ago

@QUIlToT I interpret the table as follows:

KUKA LBR iiwa 14 R820 7 DOF:

--> X = (3,31ms - 5ms * 61,91%) / 38,09% = 0,56 ms

KUKA LWR 4+ 7 DOF:

--> X = (1,82ms - 5ms * 31,78%) / 68,22% = 0,34 ms

NASA Robonaut2 'leg' + waist + arm 15 DOF:

--> X = (3,31ms - 5ms * 61,91%) / 38,09% = 0,60 ms

I don't know why the LBR has a higher avg calculation duration than the LWR (afaik they have similar kinematics) but in any case these results do not seem to contradict that 15DOF would take longer to calculate than 7DOF?

zichunxx commented 1 year ago

@jrutgeer Thanks for your patient explanation.

I mistakenly thought that only successful solutions would be used to calculate the average time.