-
-
Notifications
You must be signed in to change notification settings - Fork 627
Benchmark IK
RTB ships numerical IK solvers three ways: the fast, C-only ik_XX solvers; the pure-Python ikine_XX solvers backed by the C-accelerated ETS (fkine/Jacobian evaluated in C++); and ikine_XX backed by the pure-Python ETS fallback (fkine/Jacobian evaluated in Python too, as used in a pure-Python wheel/Pyodide build). examples/benchmark_ik.py times all three, across five solver methods (Newton-Raphson, Gauss-Newton, and Levenberg-Marquardt with the Chan, Wampler, and Sugihara damping variants), solving random reachable poses for a 7-DOF Panda.
python examples/benchmark_ik.py
No arguments; takes a minute or two. Sample sizes are deliberately small — see the comments at the top of the script — because LM Sugihara converges far slower than the other methods on random targets and would otherwise dominate the runtime. This makes it a rough comparison, not a statistically precise one; re-run it if a number looks suspect.
Numerical Inverse Kinematics Methods benchmark:
* running on Apple M1 (8 cores), 3204 MHz,
* robot is panda with 7 DoF,
* ik_XX and ikine_XX (C++ ETS) columns use 1000 random configurations,
* ikine_XX (pure Python ETS) column uses 15 (too slow at 1000).
Time per IK solution:
┌────────────────┬────────────┬────────────────────────┬────────────────────────────────┐
│ Method │ ik_XX (μs) │ ikine_XX, C++ ETS (μs) │ ikine_XX, pure Python ETS (μs) │
├────────────────┼────────────┼────────────────────────┼────────────────────────────────┤
│ Newton Raphson │ 206.5 │ 2698.6 │ 61601.6 │
│ Gauss Newton │ 116.9 │ 4154.5 │ 305377.2 │
│ LM Chan │ 80.4 │ 2685.3 │ 207802.8 │
│ LM Wampler │ 270.7 │ 6418.7 │ 452307.3 │
│ LM Sugihara │ 1876.1 │ 37681.8 │ 2529766.2 │
└────────────────┴────────────┴────────────────────────┴────────────────────────────────┘
A few things stand out:
- The C-only
ik_XXsolvers are consistently the fastest, by roughly an order of magnitude over the same method'sikine_XX/C++-ETS equivalent. - LM Sugihara is dramatically more expensive than the other four methods across all three columns — tens of times slower even in the fastest (
ik_XX) column. It trades speed for robustness on harder problems; this benchmark's random targets don't favour it. - The pure-Python ETS fallback (right column) is roughly 2-3 orders of magnitude slower than the C++ ETS column for the same solver — the cost of interpreting
fkine/Jacobian evaluation in Python at every iteration, not just the outer solver loop.
Exact numbers depend on the machine; re-run the script for your own hardware.
- Frequently asked questions (FAQ)
- Documentation Style Guide
- Background
- Key concepts
- Introduction to robot and link classes
- Working with Jupyter
- Working from the command line
- What about Simulink?
- How to contribute
- Contributors
- Coding conventions