Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwason committed Dec 13, 2023
1 parent 05f15d6 commit f389ca9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tesseract_common/include/tesseract_common/class_loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ std::vector<std::string> ClassLoader::getAvailableSections(const std::string& li
if (include_hidden)
return false;

return (section.substr(0, 1) == ".") || (section.substr(0, 1) == "_");
return (section.substr(0, 1) == ".") || (section.substr(0, 1) == "_");
};

sections.erase(std::remove_if(sections.begin(), sections.end(), search_fn), sections.end());
Expand Down
10 changes: 6 additions & 4 deletions tesseract_srdf/src/group_states.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ GroupJointStates parseGroupStates(const tesseract_scene_graph::SceneGraph& scene

bool found = std::find(group_names.begin(), group_names.end(), group_name) != group_names.end();
if (!found)
std::throw_with_nested(std::runtime_error(
tesseract_common::strFormat("GroupStates: State '%s' group '%s' does not exist!", state_name.c_str(), group_name.c_str())));
std::throw_with_nested(std::runtime_error(tesseract_common::strFormat(
"GroupStates: State '%s' group '%s' does not exist!", state_name.c_str(), group_name.c_str())));

GroupsJointState joint_state;

Expand Down Expand Up @@ -98,8 +98,10 @@ GroupJointStates parseGroupStates(const tesseract_scene_graph::SceneGraph& scene
}

if (joint_state.empty())
std::throw_with_nested(std::runtime_error(tesseract_common::strFormat(
"GroupStates: State '%s' for group '%s' is missing joint elements!", state_name.c_str(), group_name.c_str())));
std::throw_with_nested(std::runtime_error(tesseract_common::strFormat("GroupStates: State '%s' for group '%s' is "
"missing joint elements!",
state_name.c_str(),
group_name.c_str())));

auto gs = group_states.find(group_name);
if (gs == group_states.end())
Expand Down
4 changes: 2 additions & 2 deletions tesseract_srdf/src/group_tool_center_points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ GroupTCPs parseGroupTCPs(const tesseract_scene_graph::SceneGraph& /*scene_graph*

if (xml_element->Attribute("name") == nullptr || xml_element->Attribute("xyz") == nullptr ||
(xml_element->Attribute("rpy") == nullptr && xml_element->Attribute("wxyz") == nullptr))
std::throw_with_nested(
std::runtime_error(strFormat("GroupTCPs: Invalid tcp definition for group '%s'!", group_name_string.c_str())));
std::throw_with_nested(std::runtime_error(
strFormat("GroupTCPs: Invalid tcp definition for group '%s'!", group_name_string.c_str())));

std::string tcp_name_string;
tinyxml2::XMLError status = tesseract_common::QueryStringAttributeRequired(xml_element, "name", tcp_name_string);
Expand Down
27 changes: 16 additions & 11 deletions tesseract_srdf/src/groups.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ parseGroups(const tesseract_scene_graph::SceneGraph& scene_graph,
std::vector<std::string> links;
std::vector<std::string> joints;
std::vector<std::pair<std::string, std::string>> chains;

// get the links in the groups
for (const tinyxml2::XMLElement* link_xml = xml_element->FirstChildElement("link"); link_xml != nullptr;
link_xml = link_xml->NextSiblingElement("link"))
Expand All @@ -71,8 +71,8 @@ parseGroups(const tesseract_scene_graph::SceneGraph& scene_graph,
strFormat("Group: '%s' link element is missing or failed to parse attribute 'name'!", group_name.c_str())));

if (!scene_graph.getLink(link_name))
std::throw_with_nested(std::runtime_error(
strFormat("Group: '%s' link '%s' is not known to the Scene Graph!", group_name.c_str(), link_name.c_str())));
std::throw_with_nested(std::runtime_error(strFormat(
"Group: '%s' link '%s' is not known to the Scene Graph!", group_name.c_str(), link_name.c_str())));

links.push_back(link_name);
}
Expand All @@ -84,12 +84,13 @@ parseGroups(const tesseract_scene_graph::SceneGraph& scene_graph,
std::string joint_name;
tinyxml2::XMLError status = tesseract_common::QueryStringAttributeRequired(joint_xml, "name", joint_name);
if (status != tinyxml2::XML_SUCCESS)
std::throw_with_nested(std::runtime_error(
strFormat("Group: '%s' joint element is missing or failed to parse attribute 'name'!", group_name.c_str())));
std::throw_with_nested(std::runtime_error(strFormat("Group: '%s' joint element is missing or failed to parse "
"attribute 'name'!",
group_name.c_str())));

if (!scene_graph.getJoint(joint_name))
std::throw_with_nested(std::runtime_error(
strFormat("Group: '%s' joint '%s' is not known to the Scene Graph!", group_name.c_str(), joint_name.c_str())));
std::throw_with_nested(std::runtime_error(strFormat(
"Group: '%s' joint '%s' is not known to the Scene Graph!", group_name.c_str(), joint_name.c_str())));

joints.push_back(joint_name);
}
Expand All @@ -115,12 +116,16 @@ parseGroups(const tesseract_scene_graph::SceneGraph& scene_graph,
group_name.c_str())));

if (!scene_graph.getLink(base_link_name))
std::throw_with_nested(std::runtime_error(strFormat(
"Group: '%s' chain element base link '%s' is not known to the Scene Graph!", group_name.c_str(), base_link_name.c_str())));
std::throw_with_nested(std::runtime_error(strFormat("Group: '%s' chain element base link '%s' is not known to "
"the Scene Graph!",
group_name.c_str(),
base_link_name.c_str())));

if (!scene_graph.getLink(tip_link_name))
std::throw_with_nested(std::runtime_error(strFormat(
"Group: '%s' chain element tip link '%s' is not known to the Scene Graph!", group_name.c_str(), tip_link_name.c_str())));
std::throw_with_nested(std::runtime_error(strFormat("Group: '%s' chain element tip link '%s' is not known to "
"the Scene Graph!",
group_name.c_str(),
tip_link_name.c_str())));

chains.emplace_back(base_link_name, tip_link_name);
}
Expand Down

0 comments on commit f389ca9

Please sign in to comment.