diff --git a/urdf/src/model.cpp b/urdf/src/model.cpp index 708e074..af4b30e 100644 --- a/urdf/src/model.cpp +++ b/urdf/src/model.cpp @@ -257,23 +257,15 @@ bool Model::initTree(std::map &parent_link_tree) std::string child_link_name = joint->second->child_link_name; ROS_DEBUG("build tree: joint: '%s' has parent link '%s' and child link '%s'", joint->first.c_str(), parent_link_name.c_str(),child_link_name.c_str()); - - /// add an empty "world" link - if (parent_link_name == "world") - { - if (this->getLink(parent_link_name)) - { - ROS_DEBUG(" parent link '%s' already exists.", parent_link_name.c_str()); - } - else - { - ROS_DEBUG(" parent link '%s' is a special case, adding fake link.", parent_link_name.c_str()); - boost::shared_ptr link; - link.reset(new Link); - link->name = "world"; - this->links_.insert(make_pair(link->name,link)); - ROS_DEBUG(" successfully added new link '%s'", link->name.c_str()); - } + + /// deal with deprecated case + if (parent_link_name == "world" && !this->getLink(parent_link_name)){ + ROS_WARN("Joint %s specifies the world link as its parent, but there in no link called world. This used to be allowed, but this behavior has been deprecated. You need to explicitly specify each link in your tree.", joint->first.c_str()); + boost::shared_ptr link; + link.reset(new Link); + link->name = "world"; + this->links_.insert(make_pair(link->name,link)); + ROS_DEBUG(" successfully added new link '%s'", link->name.c_str()); } if (parent_link_name.empty()) diff --git a/urdf/src/urdf_check.cpp b/urdf/src/urdf_check.cpp index 748537e..7712060 100644 --- a/urdf/src/urdf_check.cpp +++ b/urdf/src/urdf_check.cpp @@ -91,7 +91,7 @@ int main(int argc, char** argv) if (!root_link) return -1; if (!root_link->child_links.empty()) - std::cout << "root Link: " << root_link->name << " has " << root_link->child_links.size() << " children" << std::endl; + std::cout << "root Link: " << root_link->name << " has " << root_link->child_links.size() << " child(ren)" << std::endl; // print entire tree