41 #include <kdl/chainfksolverpos_recursive.hpp>
42 #include <kdl/frames_io.hpp>
43 #include <urdf_model/model.h>
44 #include <urdf_parser/urdf_parser.h>
46 void printLink(
const KDL::SegmentMap::const_iterator & link,
const std::string & prefix)
48 std::cout << prefix <<
"- Segment " << GetTreeElementSegment(link->second).getName() <<
49 " has " << GetTreeElementChildren(link->second).size() <<
" children" << std::endl;
50 for (
unsigned int i = 0; i < GetTreeElementChildren(link->second).size(); i++) {
51 printLink(GetTreeElementChildren(link->second)[i], prefix +
" ");
56 int main(
int argc,
char ** argv)
59 std::cerr <<
"Expect xml file to parse" << std::endl;
62 urdf::ModelInterfaceSharedPtr robot_model = urdf::parseURDFFile(argv[1]);
64 std::cerr <<
"Could not generate robot model" << std::endl;
70 std::cerr <<
"Could not extract kdl tree" << std::endl;
75 std::cout <<
" ======================================" << std::endl;
76 std::cout <<
" Tree has " << my_tree.getNrOfSegments() <<
" link(s) and a root link" << std::endl;
77 std::cout <<
" ======================================" << std::endl;
78 KDL::SegmentMap::const_iterator root = my_tree.getRootSegment();