From 2b84aed3e5d6848dae1548ce9070a3f72631dc67 Mon Sep 17 00:00:00 2001 From: wim Date: Thu, 24 Jun 2010 19:20:16 +0000 Subject: [PATCH] initParam() calls through to urdf::initParam() --- kdl_parser/include/kdl_parser/kdl_parser.hpp | 7 +++++++ kdl_parser/src/kdl_parser.cpp | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/kdl_parser/include/kdl_parser/kdl_parser.hpp b/kdl_parser/include/kdl_parser/kdl_parser.hpp index 65720e3..ba7e2c8 100644 --- a/kdl_parser/include/kdl_parser/kdl_parser.hpp +++ b/kdl_parser/include/kdl_parser/kdl_parser.hpp @@ -51,6 +51,13 @@ namespace kdl_parser{ */ bool treeFromFile(const std::string& file, KDL::Tree& tree); +/** Constructs a KDL tree from the parameter server, given the parameter name + * \param param the name of the parameter on the parameter server + * \param tree The resulting KDL Tree + * returns true on success, false on failure + */ +bool treeFromParam(const std::string& param, KDL::Tree& tree); + /** Constructs a KDL tree from a string containing xml * \param xml A string containting the xml description of the robot * \param tree The resulting KDL Tree diff --git a/kdl_parser/src/kdl_parser.cpp b/kdl_parser/src/kdl_parser.cpp index 358e2c5..f5abc69 100644 --- a/kdl_parser/src/kdl_parser.cpp +++ b/kdl_parser/src/kdl_parser.cpp @@ -138,6 +138,15 @@ bool treeFromFile(const string& file, Tree& tree) return treeFromXml(&urdf_xml, tree); } +bool treeFromParam(const string& param, Tree& tree) +{ + urdf::Model robot_model; + if (!robot_model.initParam(param)){ + ROS_ERROR("Could not generate robot model"); + return false; + } + return treeFromUrdfModel(robot_model, tree); +} bool treeFromString(const string& xml, Tree& tree) {