40 const tinyxml2::XMLElement* srdf_xml,
41 const std::array<int, 3>& )
45 for (
const tinyxml2::XMLElement* xml_element = srdf_xml->FirstChildElement(
"group_state"); xml_element !=
nullptr;
46 xml_element = xml_element->NextSiblingElement(
"group_state"))
48 std::string group_name, state_name;
50 if (status != tinyxml2::XML_SUCCESS)
51 std::throw_with_nested(std::runtime_error(
"GroupStates: Missing or failed to parse attribute 'group'!"));
54 if (status != tinyxml2::XML_SUCCESS)
55 std::throw_with_nested(
56 std::runtime_error(
"GroupStates: Failed to parse attribute 'name' for group '" + group_name +
"'!"));
58 bool found = std::find(group_names.begin(), group_names.end(), group_name) != group_names.end();
61 "GroupStates: State '%s' group '%s' does not exist!", state_name.c_str(), group_name.c_str())));
66 for (
const tinyxml2::XMLElement* joint_xml = xml_element->FirstChildElement(
"joint"); joint_xml !=
nullptr;
67 joint_xml = joint_xml->NextSiblingElement(
"joint"))
69 std::string joint_name;
70 double joint_value{ 0 };
72 if (status != tinyxml2::XML_SUCCESS)
74 "attribute 'name' from joint element for "
75 "state '%s' in group '%s'!",
77 group_name.c_str())));
79 if (!scene_graph.
getJoint(joint_name))
81 "joint name '%s' is not know to the "
85 joint_name.c_str())));
88 if (status != tinyxml2::XML_SUCCESS)
90 "joint element with joint name '%s' is "
91 "missing or failed to parse attribute "
95 joint_name.c_str())));
97 joint_state[joint_name] = joint_value;
100 if (joint_state.empty())
102 "missing joint elements!",
104 group_name.c_str())));
106 auto gs = group_states.find(group_name);
107 if (gs == group_states.end())
110 gs = group_states.find(group_name);
113 gs->second[state_name] = joint_state;