Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check World joints in checkJointParentChildNames #1189

Merged
merged 5 commits into from
Oct 20, 2022

Conversation

scpeters
Copy link
Member

@scpeters scpeters commented Oct 15, 2022

🎉 New feature

Follow-up to #1117

Summary

Joints were added in the world scope in #1117, but the checkJointParentChildNames method in parser.hh was not updated to check these joints. A failing test is added in 4e86c3e, and then the checkModelJointParentChildNames lambda function into a template function that works for both sdf::Model and sdf::World objects, after adding the World::NameExistsInFrameAttachedToGraph API.

I recommend reviewing the changes in parser.cc without whitespace in order to more easily see how the lambda function was refactored into a templated function.

Test it

Run INTEGRATION_joint_dom or gz sdf --check test/sdf/world_joint_invalid_resolved_parent_same_as_child.sdf

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

Test that parent and child frames do not resolve
to the same link for //world/joint.

Signed-off-by: Steve Peters <[email protected]>
This refactors the checkModelJointParentChildNames
lambda function into a template function that works
for both sdf::Model and sdf::World objects, after
adding the World::NameExistsInFrameAttachedToGraph
API.

Signed-off-by: Steve Peters <[email protected]>
@scpeters scpeters requested a review from azeey as a code owner October 15, 2022 09:28
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Oct 15, 2022
@codecov
Copy link

codecov bot commented Oct 15, 2022

Codecov Report

Merging #1189 (d2779cf) into sdf13 (1c2c2af) will increase coverage by 0.00%.
The diff coverage is 97.82%.

@@           Coverage Diff           @@
##            sdf13    #1189   +/-   ##
=======================================
  Coverage   87.25%   87.26%           
=======================================
  Files         125      125           
  Lines       16114    16111    -3     
=======================================
- Hits        14061    14059    -2     
+ Misses       2053     2052    -1     
Impacted Files Coverage Δ
python/src/sdf/pyWorld.cc 53.07% <50.00%> (-0.05%) ⬇️
python/src/sdf/pyModel.cc 61.41% <100.00%> (ø)
src/World.cc 95.94% <100.00%> (+0.04%) ⬆️
src/parser.cc 87.15% <100.00%> (-0.03%) ⬇️
src/Model.cc 98.03% <0.00%> (+0.21%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Steve Peters <[email protected]>
@@ -145,6 +145,10 @@ def test_default_construction(self):
self.assertEqual(errors[1].message(),
"PoseRelativeToGraph error: scope does not point to a valid graph.")

# model dosn't have graphs, so no names should exist in graphs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# model dosn't have graphs, so no names should exist in graphs
# model doesn't have graphs, so no names should exist in graphs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -86,6 +86,10 @@ def test_default_construction(self):
self.assertEqual(errors[1].message(),
"PoseRelativeToGraph error: scope does not point to a valid graph.")

# world dosn't have graphs, so no names should exist in graphs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# world dosn't have graphs, so no names should exist in graphs
# world doesn't have graphs, so no names should exist in graphs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -154,6 +154,10 @@ TEST(DOMModel, Construction)
errors[1].Message().find(
"PoseRelativeToGraph error: scope does not point to a valid graph"))
<< errors[1];

// model dosn't have graphs, so no names should exist in graphs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// model dosn't have graphs, so no names should exist in graphs
// model doesn't have graphs, so no names should exist in graphs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -229,6 +233,9 @@ TEST(DOMModel, AddLink)
EXPECT_EQ(1u, model.LinkCount());
EXPECT_FALSE(model.AddLink(link));
EXPECT_EQ(1u, model.LinkCount());
// model dosn't have graphs, so no names should exist in graphs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// model dosn't have graphs, so no names should exist in graphs
// model doesn't have graphs, so no names should exist in graphs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -93,6 +93,10 @@ TEST(DOMWorld, Construction)
EXPECT_NE(std::string::npos,
errors[1].Message().find(
"PoseRelativeToGraph error: scope does not point to a valid graph"));

// world dosn't have graphs, so no names should exist in graphs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// world dosn't have graphs, so no names should exist in graphs
// world doesn't have graphs, so no names should exist in graphs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -384,6 +388,9 @@ TEST(DOMWorld, AddModel)
EXPECT_EQ(1u, world.ModelCount());
EXPECT_FALSE(world.AddModel(model));
EXPECT_EQ(1u, world.ModelCount());
// world dosn't have graphs, so no names should exist in graphs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// world dosn't have graphs, so no names should exist in graphs
// world doesn't have graphs, so no names should exist in graphs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scpeters scpeters dismissed ahcorde’s stale review October 20, 2022 17:24

changes have been made

@scpeters scpeters merged commit c703dee into sdf13 Oct 20, 2022
@scpeters scpeters deleted the scpeters/check_world_joint_parent_child branch October 20, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants