An optimizing IK solver based on the Lie group of rigid transforms SE(3)
Project description
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
Python
python3 -m pip install optik-py
Or, to install a prerelease version:
- Download a recent
.whl
from GitHub Releases - Run
pip install optik-py<...>.whl
(replace<...>
with the actual filename) - Test it:
python -c 'import optik'
C++ (CMake)
Include OptIK in your CMake project using FetchContent
:
include(FetchContent)
FetchContent_Declare(
optik
GIT_REPOSITORY https://github.com/kylc/optik
GIT_TAG master
SOURCE_SUBDIR "crates/optik-cpp")
FetchContent_MakeAvailable(optik)
target_link_libraries(mylib PRIVATE optik::optik)
Rust
Add OptIK as a Cargo dependency:
cargo add optik
Building Locally
git clone git@github.com:kylc/optik.git
# Build the Rust library
cargo build --release
# Build a Python wheel
maturin build --release -m crates/optik-py/Cargo.toml
# Build the C++ example
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ../examples
cmake --build .
Usage
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for optik_py-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6f0edbe0198b06f108a22faa35df9b9bb0f0f56d20e333e165cb979e03e0d94 |
|
MD5 | b75ee2ba0824a59df51ea952b9dd00d4 |
|
BLAKE2b-256 | 5b2f7d1b2790c61e9c89b25d18c62d3618072e405b655f5295aac2b1f8c3bef6 |
Hashes for optik_py-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60b9e205ea5d91808656fbe11b1843d2dbbc608ed3f95e6b1288485bb2be3792 |
|
MD5 | 630405d930f8397dd821d16989c3394d |
|
BLAKE2b-256 | 843678df0fef281dd64b1855a830dd6844aa416f7dabfe4b0a0f26d439ef8490 |
Hashes for optik_py-0.1.0-cp38-abi3-macosx_10_12_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29eeeba4f478f62934e551df1dcbfe9f27d8e4ac262c4984841fb5ca0ed88f99 |
|
MD5 | d2658d9772611d81283ada4d41d8b2b6 |
|
BLAKE2b-256 | 61c4cf6a6f82969278f0e5cbc07734c4815fda65b4bf35643246eb1a69123d1a |