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

Question On How To Use TRAC-IK?

asked 2016-01-15 03:29:14 -0600

jzhan1 gravatar image

I am trying to experiment with code that uses the TRAK_IK_LIB, before implementing it into my robot. The source code may be found here ( ). The Readme for it provides the following as the example for use: TRAC_IK::TRAC_IK ik_solver(KDL::Chain chain, KDL::JntArray lower_joint_limits, KDL::JntArray upper_joint_limits, double timeout_in_ms, double error, TRAC_IK::SolveType type=TRAC_IK::Speed);

May someone provide an example of how to initialize JntArray and specify a value for TRAC_IK::Speed?

Thank you in advance.

edit retag flag offensive close merge delete


Might be a good idea to describe what you want to do with it exactly. If it's just for a MoveIt Configuration for instance, you don't need to do any programming.

gvdhoorn gravatar image gvdhoorn  ( 2016-01-15 05:21:46 -0600 )edit

Ultimately, I hope to configure it for a robot with 6 degrees of freedom, but for now, I'm just hoping to figure out how to run this code. Ideally, without MoveIt! configuration, though that could be a last resort.

jzhan1 gravatar image jzhan1  ( 2016-01-15 09:14:11 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-15 09:41:22 -0600

pbeeson gravatar image

updated 2016-01-15 14:10:33 -0600

1) v1.3.9 of trac_ik now has a constructor that takes the base_link name, tip_link name, and rosparam location of the URDF (typically "/robot_description") and handles the URDF parsing into KDL for you.

2) If you are hard coding all this without a URDF for some reason, a JntArray is easy to initialize and populate from an existing array.

KDL::JntArray a;
for(int i=0;i<6;i++)

3) The timeout is actually in seconds (I need to fix that readme typo) so a reasonable timeout is usually 0.01 or even 0.005.

4) TRAC_IK::Speed in an enumerated type in the TRAC_IK namespace saying that the MODE is to return as soon as any IK is found, There are other modes you can set. These should be in the trac_ik.h header and explained on the Bitbucket

edit flag offensive delete link more


Thanks a lot, I posted it as an issue. I didn't realize URDF was supposed to be used, but am now using it. The descriptions helped me a lot with further understanding the code.

jzhan1 gravatar image jzhan1  ( 2016-01-15 14:24:31 -0600 )edit

Question Tools

1 follower


Asked: 2016-01-15 03:29:14 -0600

Seen: 930 times

Last updated: Jan 15 '16