caelan / pybullet-planning

PyBullet Planning
https://pypi.org/project/pybullet-planning/
MIT License
407 stars 114 forks source link

question about IKFast inverse kinematics arguments #10

Closed tomsilver closed 2 years ago

tomsilver commented 2 years ago

Hi Caelan :) I hope you're well!

I have a question about the arguments to IKFast inverse kinematics. I'm looking here:

https://github.com/caelan/pybullet-planning/blob/8953d2dbfd789d5681053eb4993b5ddc0d910a6b/pybullet_tools/ikfast/ikfast.py#L163

The argument that I don't understand is free_positions. I'm guessing that this has something to do with wanting multiple possible solutions from the solver. But what does the IKFast solver expect for that argument? Sorry that I can't find documentation on the IKFast side for this.

Thanks for your help!

caelan commented 2 years ago

Sort of. IKFast is an analytical IK solver that essentially uses sympy to compute a C++ program that solves a system of 6 FK equations that determine a link's pose. Because there are 6 constraints, it can only enumerate a finite set of solutions when no more than 6 joint positions are variables. So, for robots with d > 6 joints, the remaining (d - 6) joint positions need to be provided. This is typically done via rejection sampling the remaining "free joints" before calling IKFast, which is what I've implemented. Note that a user can chose which joints are free. Each selection defines a separate IKFast C++ program.

The original IKFast page has a bit more about this: http://openrave.org/docs/latest_stable/openravepy/databases.inversekinematics/.

Hope this helps!