How to obtain multiple IK solutions?

1,575 views
Skip to first unread message

12bee...@seecs.edu.pk

unread,
Nov 11, 2015, 1:56:36 PM11/11/15
to MoveIt! Users
I'm using the IKFast plugin for calculating the IK solution for a 5DoF robotic arm (with one free joint). Looking at the generated plugin (and the underlying cpp file), it seems that the IK solver returns multiple IK solutions. So why is it that the RobotState.setFromIK function only returns a single solution by storing the joint values in the variables of the joint group it is given. Also, so far I was assuming that the current state of the joint group served as the seed value, but when I tested this by randomizing the joint states, I noticed that I always for the same solution for a given end effector pose regardless of the current state (though I haven't ruled out the possibility that the target pose I gave may in fact only have one possible solution).

I would like to obtain multiple solutions with different values of the free joint and/or factor in the seed value. How can I achieve that without bypassing the plugin (I want to avoid using the IKFast generated cpp file directly)?

Thank you in advance.

Simon Schmeißer

unread,
Nov 12, 2015, 4:47:07 AM11/12/15
to MoveIt! Users
The foundation for this has recently been added, but apparently so far nobody has worked on exposing it further up the stack.

The pull request has been merged into jade-devel:
https://github.com/ros-planning/moveit_core/pull/248

I would be happy to see that as well, also for compute cartesian path it would be really handy. Just code up something that makes sense to you and file a pull request to start a discussion on it.

(keep in mind that KDL, the default plugin, doesn't support multiple solutions)

Shaun Edwards

unread,
Nov 12, 2015, 11:41:06 AM11/12/15
to Simon Schmeißer, MoveIt! Users
Just an FYI, we requested this change for exactly what Simon suggested, calculating Cartesian paths (using Descartes: http://wiki.ros.org/descartes ).  We've even managed to get KDL to return multiple solutions by searching through seed states (see https://github.com/ros-industrial-consortium/descartes/blob/indigo-devel/descartes_moveit/src/moveit_state_adapter.cpp#L130-L134 ).  The seed search (https://github.com/ros-industrial-consortium/descartes/blob/hydro-devel/descartes_moveit/src/seed_search.cpp ) is by no means complete, but it works well enough for spherical wrist configurations.

Sachin Chitta

unread,
Nov 12, 2015, 5:34:19 PM11/12/15
to 12bee...@seecs.edu.pk, MoveIt! Users
If you have the IKFast solver configured for a group, you can get access to it directly using the getSolverInstance() method for a joint model group. You can then call the kinematics base API and it will get you all the solutions (you won't be calling the IKFast API directly). We can add a call from robot_state into that but probably not call it setFromIK since it will be returning a bunch of solutions but not setting them.

Also, IKFast is an analytical solver. The seed state will not have an effect on the solutions you get (for 6 dof). For a 5 DOF arm solving to a 6 DOF pose, you may likely not have any solution sometimes. Solvers like KDL use the seed state as an initial guess for their numerical routines.

Sachin

Shaun Edwards

unread,
Nov 12, 2015, 9:20:44 PM11/12/15
to Sachin Chitta, 12bee...@seecs.edu.pk, MoveIt! Users
Sachin,

As far as I know, the IKFast generators that fill out the getAllIK method have not been merged: https://github.com/ros-planning/moveit_ikfast/pull/50 

Was it merged from another PR?

Shaun

Sachin Chitta

unread,
Nov 13, 2015, 12:51:12 AM11/13/15
to Shaun Edwards, 12bee...@seecs.edu.pk, MoveIt! Users

Shaun Edwards

unread,
Nov 13, 2015, 11:00:11 AM11/13/15
to Sachin Chitta, 12bee...@seecs.edu.pk, MoveIt! Users
Yes, but the changes to IK were made in Indigo?  Since moveit_ikfast generates code, I don't think it's too risky to accept this change into Indigo.  This would ensure LTS users would see the benefit of getting multiple IKs.

12bee...@seecs.edu.pk

unread,
Nov 14, 2015, 5:39:07 AM11/14/15
to MoveIt! Users

Thanks for the input everyone. In the end I figured it'd be easier to bypass the plugin altogether and call the IK function of the IKFast cpp file directly and apply joint limits to the solutions in my own code (I'm using Indigo so I wasn't sure if the aforementioned alterations would work).

P.S. It'd be helpful if this functionality were offered too (i.e. being able to receive the raw output of the IKFast function).

Andres Torres Garcia

unread,
Jul 5, 2016, 10:36:23 PM7/5/16
to MoveIt! Users
Hi,

How did you bypass the Moveit! plugin? Including the source and header file of the analytical IK solution of the robot? I'm also using Indigo and I also need multiple solutions. Is there other way to get the ik solutions from Moveit! using Indigo? 

Best,

Miros8111

unread,
May 6, 2017, 4:25:56 PM5/6/17
to MoveIt! Users
Dear  Andres

I am facing the same problem and need multiple IK solutions. Could you please share how did you obtain IK solutions exactly from the ikfast.cpp file. I would be really grateful

Thanks for you answer

Best regard Miroslav Kohut

Dňa streda, 6. júla 2016 4:36:23 UTC+2 Andres Torres Garcia napísal(-a):
Reply all
Reply to author
Forward
0 new messages