39 std::tuple<GroupNames, ChainGroups, JointGroups, LinkGroups>
 
   41             const tinyxml2::XMLElement* srdf_xml,
 
   42             const std::array<int, 3>& )
 
   51   for (
const tinyxml2::XMLElement* xml_element = srdf_xml->FirstChildElement(
"group"); xml_element != 
nullptr;
 
   52        xml_element = xml_element->NextSiblingElement(
"group"))
 
   54     std::string group_name;
 
   56     if (status != tinyxml2::XML_SUCCESS)
 
   57       std::throw_with_nested(std::runtime_error(
"Group: Missing or failed to parse attribute 'name'!"));
 
   59     std::vector<std::string> links;
 
   60     std::vector<std::string> joints;
 
   61     std::vector<std::pair<std::string, std::string>> chains;
 
   64     for (
const tinyxml2::XMLElement* link_xml = xml_element->FirstChildElement(
"link"); link_xml != 
nullptr;
 
   65          link_xml = link_xml->NextSiblingElement(
"link"))
 
   67       std::string link_name;
 
   69       if (status != tinyxml2::XML_SUCCESS)
 
   70         std::throw_with_nested(std::runtime_error(
 
   71             strFormat(
"Group: '%s' link element is missing or failed to parse attribute 'name'!", group_name.c_str())));
 
   73       if (!scene_graph.
getLink(link_name))
 
   74         std::throw_with_nested(std::runtime_error(
strFormat(
 
   75             "Group: '%s' link '%s' is not known to the Scene Graph!", group_name.c_str(), link_name.c_str())));
 
   77       links.push_back(link_name);
 
   81     for (
const tinyxml2::XMLElement* joint_xml = xml_element->FirstChildElement(
"joint"); joint_xml != 
nullptr;
 
   82          joint_xml = joint_xml->NextSiblingElement(
"joint"))
 
   84       std::string joint_name;
 
   86       if (status != tinyxml2::XML_SUCCESS)
 
   87         std::throw_with_nested(std::runtime_error(
strFormat(
"Group: '%s' joint element is missing or failed to parse " 
   89                                                             group_name.c_str())));
 
   91       if (!scene_graph.
getJoint(joint_name))
 
   92         std::throw_with_nested(std::runtime_error(
strFormat(
 
   93             "Group: '%s' joint '%s' is not known to the Scene Graph!", group_name.c_str(), joint_name.c_str())));
 
   95       joints.push_back(joint_name);
 
   99     for (
const tinyxml2::XMLElement* chain_xml = xml_element->FirstChildElement(
"chain"); chain_xml != 
nullptr;
 
  100          chain_xml = chain_xml->NextSiblingElement(
"chain"))
 
  102       std::string base_link_name, tip_link_name;
 
  104       if (status != tinyxml2::XML_SUCCESS)
 
  105         std::throw_with_nested(std::runtime_error(
strFormat(
"Group: '%s' chain element is missing or failed to parse " 
  108                                                             group_name.c_str())));
 
  111       if (status != tinyxml2::XML_SUCCESS)
 
  112         std::throw_with_nested(std::runtime_error(
strFormat(
"Group: '%s' chain element is missing or failed to parse " 
  115                                                             group_name.c_str())));
 
  117       if (!scene_graph.
getLink(base_link_name))
 
  118         std::throw_with_nested(std::runtime_error(
strFormat(
"Group: '%s' chain element base link '%s' is not known to " 
  121                                                             base_link_name.c_str())));
 
  123       if (!scene_graph.
getLink(tip_link_name))
 
  124         std::throw_with_nested(std::runtime_error(
strFormat(
"Group: '%s' chain element tip link '%s' is not known to " 
  127                                                             tip_link_name.c_str())));
 
  129       chains.emplace_back(base_link_name, tip_link_name);
 
  132     if (!chains.empty() && links.empty() && joints.empty())
 
  134       chain_groups[group_name] = chains;
 
  135       group_names.insert(group_name);
 
  137     else if (chains.empty() && !links.empty() && joints.empty())
 
  139       link_groups[group_name] = links;
 
  140       group_names.insert(group_name);
 
  142     else if (chains.empty() && links.empty() && !joints.empty())
 
  144       joint_groups[group_name] = joints;
 
  145       group_names.insert(group_name);
 
  149       std::throw_with_nested(
 
  150           std::runtime_error(
strFormat(
"Group: '%s' is empty or multiple types were provided!", group_name.c_str())));
 
  154   return std::make_tuple(group_names, chain_groups, joint_groups, link_groups);