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

As mentioned in the question, I was trying to get the KDL tree of the robot by loading the URDF using treeFromFile() function with taking the URDF from the params server. I changed it to treeFromString() as the URDF is stored as a string in the params server. Below is the modified code.

KDL::Tree lumi_tree;
std::string lumi_robot;

node.param("/robot_description", lumi_robot, std::string()); if (!kdl_parser::treeFromString(lumi_robot, lumi_tree)){ ROS_ERROR("Failed to construct kdl tree"); return false; }

As mentioned in the question, I was trying to get the KDL tree of the robot by loading the URDF using treeFromFile() function with taking the URDF from the params server. I changed it to treeFromString() as the URDF is stored as a string in the params server. Below is the modified code.

KDL::Tree lumi_tree;
std::string lumi_robot;

node.param("/robot_description", lumi_robot, std::string()); if (!kdl_parser::treeFromString(lumi_robot, lumi_tree)){ ROS_ERROR("Failed to construct kdl tree"); return false; }}

Now the KDL tree is formed and is used for further calculations.

As mentioned in the question, I was trying to get the KDL tree of the robot by loading the URDF using treeFromFile() function with taking the URDF from the params server. I changed it to treeFromString() as the URDF is stored as a string in the params server. Below is the modified code.

KDL::Tree lumi_tree;
std::string lumi_robot;
node.param("/robot_description", lumi_robot, std::string());
if (!kdl_parser::treeFromString(lumi_robot, lumi_tree)){
    ROS_ERROR("Failed to construct kdl tree");
    return false;
}

Now the KDL tree is formed and is used for further calculations.

Thanks @pmuthu2s and @gvdroorn for their inputs.

As mentioned in the question, I was trying to get the KDL tree of the robot by loading the URDF using treeFromFile() function with taking the URDF from the params server. I changed it to treeFromString() as the URDF is stored as a string in the params server. Below is the modified code.

KDL::Tree lumi_tree;
std::string lumi_robot;
node.param("/robot_description", lumi_robot, std::string());
if (!kdl_parser::treeFromString(lumi_robot, lumi_tree)){
    ROS_ERROR("Failed to construct kdl tree");
    return false;
}

Now the KDL tree is formed and is used for further calculations.

Thanks @pmuthu2s and @gvdroorn @gvdhoorn for their inputs.

As mentioned in the question, I was trying to get the KDL tree of the robot by loading the URDF using treeFromFile() function with taking the URDF from the params server. I changed it to treeFromString() as the URDF is stored as a string in after getting it from the params server. Below is the modified code.

KDL::Tree lumi_tree;
std::string lumi_robot;
node.param("/robot_description", lumi_robot, std::string());
if (!kdl_parser::treeFromString(lumi_robot, lumi_tree)){
    ROS_ERROR("Failed to construct kdl tree");
    return false;
}

Now the KDL tree is formed and is used for further calculations.

Thanks @pmuthu2s and @gvdhoorn for their inputs.