deprecate 'bug' where you are allowed to not specify the root link if you call it 'world'

This commit is contained in:
wim 2009-11-21 01:18:39 +00:00
parent a0ffa1a8b8
commit ac0782a7fa
2 changed files with 10 additions and 18 deletions

View File

@ -258,22 +258,14 @@ bool Model::initTree(std::map<std::string, std::string> &parent_link_tree)
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;
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;
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())

View File

@ -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