ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Return of multple IK configurations of goal state.

asked 2018-10-17 04:10:03 -0600

I have searched a lot for the way of obtaining a set of possible IK robot configurations satisfying a defined goal pose. This is an ability used widely in Robotics for motion and action planning and I am struggling a lot to find a way to do it.

I understand that this is a capability provided by the kinematics plugin being used, and that the kinematics::KinematicsBase (which as far as I understand is the interface all kinematics plugins implement) offers the method getPositionIK, which should return precisely a set of robot configurations, but I do not know how to use it and cannot find an example of it.

First. This method seems not to be called by almost anyone, which makes me wonder whether I am looking at the wrong place.

Second. How do you obtain an instance of the current move group kinematic solver plugin? in order to call this method? (which kinematics solver plugins implements correctly this method?)

I want to get a pseudo-complete set of IK configurations, not just play with the seed state.

Currently, I am using a UR10 6DOF with trac-IK kinematics plugin, but I don't think this is a robot-related answer, depending on the DOF of the robot the method should return IK solutions if they exist and if they are multiple.

I require this to plan robot actions (multiple consecutive movements) that are sometimes only possible if the action is started in a defined robot configuration.

edit retag flag offensive close merge delete

Comments

Not an answer, but:

This is an ability used widely in Robotics for motion and action planning and I am struggling a lot to find a way to do it.

a complicating factor is that the goal of many IK solvers in ROS is to be geometry agnostic (ie: solver works with arbitrary kinematic ..

gvdhoorn gravatar image gvdhoorn  ( 2018-10-18 06:19:14 -0600 )edit

.. configurations without recompilation or code changes).

Some succeed, but then the question "give me all solutions for a specific pose" becomes much harder than in the "simple, traditional" 6 or 5 axis case.

gvdhoorn gravatar image gvdhoorn  ( 2018-10-18 06:20:09 -0600 )edit

1 Answer

Sort by » oldest newest most voted
3

answered 2019-01-28 08:51:58 -0600

updated 2019-01-28 08:53:49 -0600

I find a way of obtaining some of the possible IK solutions for a given goal state, by using a custom implementation of the GroupStateValidityCallbackFn when calling the method setFromIK(...) from a robot_state::RobotState instance.

With this callback function, I can determine if the returned IK solution is valid or not and then try to get another one that fulfills my requirements.

This approach works along with the moveit plugin structure by only using a generic function to obtain an IK solution which is then implemented by the IK solver plugin with which the robot is configured.

The code looks like this:

std::vector<double*> invalid_states;        //Variable holding the discarted IK solutions.

robot_state::RobotState target_state( move_group_interface_instance.getCurrentState() );

while( target_state.setFromIK(joint_model_group, target_pose, NUMBER_OF_ATTEMPS, TIMEOUT, checkIkValidity)) ){
   // Plann for following motions using the return state as start state, and validate whether the IK solutions works or should be discarded
   // if (solution is not valid)
   //    add IK solution to invalid_states vector
}

Then my implementation of the GroupStateValidityCallbackFn:

bool checkIkValidity(robot_state::RobotState* robot_state, const robot_state::JointModelGroup* joint_group, const double* joint_group_variable_values){
        return true/false // Depending on your desition scheme.
    }

Checks if the returned IK solution is too similar to the discarded IK solutions saved on the invalid_states vector.

I realize that this function should be configured depending on the robot kinematics configuration (i.g. max possible IK solutions, timeout, IK solutions similarity measurment...etc) but in any case, it worked for me and might do the trick for someone else too.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2018-10-17 04:10:03 -0600

Seen: 784 times

Last updated: Jan 28 '19