Ask Your Question
0

How to get KDL solver to solve for 6D, and not 3D only.

asked 2020-05-04 18:22:22 -0500

Pinknoise2077 gravatar image

Hi all,

I am trying to use KDL to calculate the inverse kinematics of a UR5 robot. I am using something like this

constexpr std::size_t num_joints = 6;
// initial guess of joint angles 
KDL::JntArray joints_init;
joints_init.resize(num_joints);
// joints_init.data[0] = -0.5;
// joints_init.data[1] = -M_PI / 2;
// joints_init.data[2] = -M_PI / 2;
// joints_init.data[4] = M_PI / 2;
// joints_init.data[5] = 0.3;

/**********************************
 * target robot pose of tool w.r.t.
 *********************************/
KDL::Frame target_frame; // set desired end effector position

/***************************************************************************
 * pose corresponding to [0, -PI/2, -PI/2, 0, PI/2, 0] according to TF
 **************************************************************************/
KDL::Vector pos;
pos.data[0] = -0.675;
pos.data[1] = 0.1110;
pos.data[2] = 0.511;

// set desired end effector rotation
KDL::Rotation rot;
target_frame.p = pos;
target_frame.M = rot.RPY(-3.141, -1.568, -0.004);

KDL::JntArray joints_result;
joints_result.resize(num_joints);

std::cout << "Calling solver for IK!" << std::endl;
int status = ik_solver.CartToJnt(joints_init, target_frame, joints_result);

It seems that this works for the position only. I thought that the solver should solve for 6D also. Am I using this wrong? Does it only solve for position (3D) and not for the full pose(6D)?

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-05-06 12:53:37 -0500

Nitesh_j gravatar image

In simple words 6d will have more flexibility on complex task and it will faster interms of calculating the position , velocity, I would suggest to go with ik fast from open rave ....or try the UR's Ur kinematics package to sort out the confusion

edit flag offensive delete link more

Comments

Thanks for the answer. I've figured a much better solution after being disappointed with how KDL IK solver performed. My solution was to switch to the symbolic version of the IK by using the ur_kinematics ROS package from https://github.com/ros-industrial/universal_robot. It now works like a charm, returns a max of 8 solutions, and always work.

Pinknoise2077 gravatar image Pinknoise2077  ( 2020-05-06 13:53:27 -0500 )edit

All the best

Nitesh_j gravatar image Nitesh_j  ( 2020-05-06 13:59:46 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2020-05-04 18:22:22 -0500

Seen: 131 times

Last updated: May 06 '20