improve detection of valid chains
This commit is contained in:
parent
e29657e464
commit
91ab5c7cdb
|
@ -179,13 +179,26 @@ void srdf::Model::loadGroups(const urdf::ModelInterface &urdf_model, TiXmlElemen
|
||||||
}
|
}
|
||||||
bool found = false;
|
bool found = false;
|
||||||
boost::shared_ptr<const urdf::Link> l = urdf_model.getLink(tip_str);
|
boost::shared_ptr<const urdf::Link> l = urdf_model.getLink(tip_str);
|
||||||
|
std::set<std::string> seen;
|
||||||
while (!found && l)
|
while (!found && l)
|
||||||
{
|
{
|
||||||
|
seen.insert(l->name);
|
||||||
if (l->name == base_str)
|
if (l->name == base_str)
|
||||||
found = true;
|
found = true;
|
||||||
else
|
else
|
||||||
l = l->getParent();
|
l = l->getParent();
|
||||||
}
|
}
|
||||||
|
if (!found)
|
||||||
|
{
|
||||||
|
l = urdf_model.getLink(base_str);
|
||||||
|
while (!found && l)
|
||||||
|
{
|
||||||
|
if (seen.find(l->name) != seen.end())
|
||||||
|
found = true;
|
||||||
|
else
|
||||||
|
l = l->getParent();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (found)
|
if (found)
|
||||||
g.chains_.push_back(std::make_pair(base_str, tip_str));
|
g.chains_.push_back(std::make_pair(base_str, tip_str));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue