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

how to use the kdl parser

asked 2013-03-12 10:56:20 -0500

rdd0101 gravatar image

Dear Sir,

I have been trying to use the KDL parser in ros to find the kinematic model of the robot arm urdf description in .xml

Could you please guide me how to use the KDL parser as it is not clear through the kdl_parser documentation.

Thanking you for your time

Regards rdd0101

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2013-03-13 11:07:35 -0500

I thought the kdl_parser tutorial gave a fairly clear usage explanation:

#include <kdl_parser/kdl_parser.hpp>
KDL::Tree robot_kin;
kdl_parser::treeFromFile("my_robot.urdf", robot_kin);

(the tutorial also provides similar examples for initializing from a parameter or string)

Once you have a KDL::Tree, you probably want to calculate various sorts of kinematics. The KDL Documentation provides some good examples here:

KDL::Chain chain;
robot_kin.getChain("base_link", "tool", chain);

KDL::JntArray joint_pos(chain.getNrOfJoints());
KDL::Frame cart_pos;
KDL::ChainFkSolverPos_recursive fk_solver(chain);
fk_solver.JntToCart(joint_pos, cart_pos);

However, you might consider staying within the ROS framework for basic kinematics, rather than working in KDL directly. This allows you to use ROS functions to extract different kinematic groups, use robot-specific kinematics plugins, detect collisions, etc.

The approach differs between whether you are using arm_navigation or moveIt. Both are fairly well documented, with examples at the links given above.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-03-12 10:56:20 -0500

Seen: 1,765 times

Last updated: Mar 13 '13