OptIK
A fast inverse kinematics solver for arbitrary serial chains, providing Rust and Python programming interfaces.
The implementation is similar to TRAC-IK [1] in that a nonlinear optimization problem is formulated and minimized using an SLSQP solver [2]. However, this work differs in a couple of ways:
- The gradient of the objective function is computed analytically. This is an immediate 2x performance improvement over finite difference approaches, because it requires only one evaluation of the forward kinematics as opposed to two (or more).
- Random restarting of the nonlinear solver is implemented in a work stealing parallel fashion, so that overall solve time is decreased thanks to the improved chance of finding a good seed.
- Random number generator seeds are carefully controlled in a way that produces deterministic results. (Note that this is only true in single-threaded mode, for now.)
- A parallel Newton's method solver is not included, because the performance of the full nonlinear problem is quite good on its own.
Benchmark
NOTE: These benchmarks are provisional and conclusions should not yet be drawn.
We compare to TRAC-IK by drawing a random valid joint configuration, mapping into Cartesian space with forward kinematics, and then asking each solver to generate an inverse kinematics solution using a random initial guess.
Note that this methodology differs from the original TRAC-IK benchmark which solves for configurations along a dense trajectory, meaning seeds are always relatively close. The benchmark shown below is more similar to a motion planning workload, in which samples are randomly drawn from a space with little knowledge of a nearby seed.
Timing is of a single inverse kinematics solve.
Setup
- Download a recent
.whl
from GitHub Releases - Run
pip install optik<...>.whl
(replace<...>
with the actual filename) - Test it:
python -c 'import optik'
Usage
Lines 22 to 30 in 4ef93d4
References
P. Beeson and B. Ames, “TRAC-IK: An open-source library for improved solving of generic inverse kinematics,” in 2015 IEEE-RAS 15th International Conference on Humanoid Robots (Humanoids), Seoul, South Korea: IEEE, Nov. 2015, pp. 928–935. doi: 10.1109/HUMANOIDS.2015.7363472.
J. Williams, "Modern Fortran Edition of the SLSQP Optimizer", Version 1.4.1, 4 Jun 2023, https://github.com/jacobwilliams/slsqp
J. Solà, J. Deray, and D. Atchuthan, “A micro Lie theory for state estimation in robotics.” arXiv, Dec. 08, 2021. Accessed: Jul. 24, 2023. [Online]. Available: http://arxiv.org/abs/1812.01537