gkjohnson / closed-chain-ik-js

A generalized inverse kinematics solver that supports closed chains for parallel kinematics systems, dynamic reconfiguration, and arbitrary joint configuration based on damped least squares error minimization techniques
https://gkjohnson.github.io/closed-chain-ik-js/dist/index.html
Apache License 2.0
184 stars 29 forks source link

Improve tolerance at fully extended configurations #69

Open gkjohnson opened 3 years ago

gkjohnson commented 3 years ago

Once a system has been fully extended like the following it can get "stuck" in that pose with any attempt to solve resulting in divergence because moving one of the fully extended joints even a small amount will result in it diverging before it converges.

Some things to look in to:

image

gkjohnson commented 3 years ago

Taking a step towards a known good pose like the rest pose before solve seems to alleviate this issue a bit but can cause jumping when full extended as the solve diverges and resets the previous position and another step is taken the next frame. Perhaps the step can be undone if the solve diverges?

EDIT: Only setting the angles if the solution CONVERGES seems to be a good compromise. It lets the IK solution thrash around but only applies valid angles to visible model