43 #include <urdf/urdfdom_compatibility.h> 44 #include <kdl/frames_io.hpp> 74 case urdf::Joint::FIXED: {
77 case urdf::Joint::REVOLUTE: {
81 case urdf::Joint::CONTINUOUS: {
85 case urdf::Joint::PRISMATIC: {
90 ROS_WARN(
"Converting unknown joint type of joint '%s' into a fixed joint",
104 double kdl_mass = i->mass;
132 std::vector<urdf::LinkSharedPtr> children = root->child_links;
133 ROS_DEBUG(
"Link %s had %zu children", root->name.c_str(), children.size());
137 if (root->inertial) {
138 inert =
toKdl(root->inertial);
146 root->parent_joint->parent_to_joint_origin_transform), inert);
149 tree.
addSegment(sgm, root->parent_joint->parent_link_name);
152 for (
size_t i = 0; i < children.size(); i++) {
163 TiXmlDocument urdf_xml;
164 urdf_xml.LoadFile(file);
172 ROS_ERROR(
"Could not generate robot model");
180 TiXmlDocument urdf_xml;
181 urdf_xml.Parse(xml.c_str());
188 if (!robot_model.
initXml(xml_doc)) {
189 ROS_ERROR(
"Could not generate robot model");
198 if (!robot_model.getRoot()) {
202 tree =
KDL::Tree(robot_model.getRoot()->name);
205 if (robot_model.getRoot()->inertial) {
206 ROS_WARN(
"The root link %s has an inertia specified in the URDF, but KDL does not " 207 "support a root link with an inertia. As a workaround, you can add an extra " 208 "dummy link to your URDF.", robot_model.getRoot()->name.c_str());
212 for (
size_t i = 0; i < robot_model.getRoot()->child_links.size(); i++) {
KDL_PARSER_PUBLIC bool treeFromUrdfModel(const urdf::ModelInterface &robot_model, KDL::Tree &tree)
KDL::Vector toKdl(urdf::Vector3 v)
URDF_EXPORT bool initXml(TiXmlElement *xml)
static Rotation Quaternion(double x, double y, double z, double w)
bool addChildrenToTree(urdf::LinkConstSharedPtr root, KDL::Tree &tree)
KDL_PARSER_PUBLIC bool treeFromXml(TiXmlDocument *xml_doc, KDL::Tree &tree)
KDL_PARSER_PUBLIC bool treeFromFile(const std::string &file, KDL::Tree &tree)
KDL_PARSER_PUBLIC bool treeFromString(const std::string &xml, KDL::Tree &tree)
URDF_EXPORT bool initParam(const std::string ¶m)
KDL_PARSER_PUBLIC bool treeFromParam(const std::string ¶m, KDL::Tree &tree)
RotationalInertia getRotationalInertia() const
bool addSegment(const Segment &segment, const std::string &hook_name)