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

Revision history [back]

click to hide/show revision 1
initial version

Hey,

I know it is very late!

But here is the solution for the same ! May be it will be helpful to others!

#include <kdl_parser/kdl_parser.hpp>
#include <urdf/model.h>
#include <iostream>

int main(int argc, char** argv)
{
  std::string filename = "PATH to URDF";
  TiXmlDocument file_xml(filename);
  file_xml.LoadFile();
  KDL::Tree my_tree;
  urdf::Model my_model;
    if (!my_model.initXml(&file_xml))
        {
             std::cout<<"Failed to parse urdf robot model";
            return false;
        }
    if (!kdl_parser::treeFromFile(filename, my_tree)){
      std::cout<<"Failed to construct kdl tree";
      return false;
   }
}