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

parsing: Add support for SDFormat 1.8 model composition (redo) #15099

Merged
merged 2 commits into from
Jun 3, 2021

Conversation

azeey
Copy link
Contributor

@azeey azeey commented May 27, 2021

This a redo of #14401 but does not create a frame for each model in the parent scope of the model. There is still a frame associated with each model, but it's named __model__ and is found inside the model instance.


Description from #14401:

Changes in behavior:

  • Models nested via the <include> tag are no longer flattened, which means each included model will have its own model instance.
  • drake::multibody::Parser::AddAllModelsFromFile now returns all added models including nested models

Note: This does not use a custom parser for URDFs via libsdformat's Interface API, and thus may incur unexpected behavior when including URDF files from SDFormat pending the full resolution of #14295.


This change is Reviewable

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

Assigning +@EricCousineau-TRI for feature review, or delegation to another reviewer.

Reviewable status: LGTM missing from assignee EricCousineau-TRI(platform), needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI)

@EricCousineau-TRI
Copy link
Contributor

Thanks for the ping!

I compared patch resulting from #14401 and this PR's current patch.
Saw relevant changes:

  • No longer add model-named frame at enclosing scope
  • Mitigation code added to handle mapping from SDFormat's reference to enclosing-scope frame name to the more explicit __model__ frame.
cd drake
# 315334b  - old pr, merged
# 1041c6c - current pr, current rev
git diff 315334b~ 315334b > /tmp/patch-old.diff
git diff $(git merge-base 1041c6c upstream/master) 1041c6c > /tmp/patch-new.diff
meld /tmp/patch-{old,new}.diff

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

:lgtm: per patch-comparison comment above; also, pending CI failures.
Also, just a minor BTW on testing code.

Reviewed 12 of 12 files at r1.
Reviewable status: 1 unresolved discussion, needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @azeey)

a discussion (no related file):
nit CI is failing due to lint failures.

Can you fix this?



multibody/parsing/test/detail_sdf_parser_test.cc, line 498 at r1 (raw file):

        "Verify that static models don't need to have a canonical link");
    PlantAndSceneGraph pair;
    DRAKE_ASSERT_NO_THROW(pair = ParseTestString(R"""(

BTW Still not sure if I see the value of ASSERT_NO_THROW. If this fails, I don't really care about subsequent code running. (In fact, future steps will prolly segfault?)

Consider removing?


multibody/parsing/test/detail_sdf_parser_test.cc, line 498 at r1 (raw file):

        "Verify that static models don't need to have a canonical link");
    PlantAndSceneGraph pair;
    DRAKE_ASSERT_NO_THROW(pair = ParseTestString(R"""(

BTW Consider changing PlantAndSceneGraph to std::pair<...> so you could use a structured binding.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

+@sammy-tri for follow-up platform review (since you reviewed the first) - thank!

Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @azeey and @sammy-tri)

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 unresolved discussions, LGTM missing from assignee sammy-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @azeey, @EricCousineau-TRI, and @sammy-tri)

a discussion (no related file):
Working: Testing in Anzu CI.


@azeey
Copy link
Contributor Author

azeey commented Jun 3, 2021


multibody/parsing/test/detail_sdf_parser_test.cc, line 498 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

BTW Still not sure if I see the value of ASSERT_NO_THROW. If this fails, I don't really care about subsequent code running. (In fact, future steps will prolly segfault?)

Consider removing?

I'm used to CI infrastructure where tests with segfaults end up with different names on the dashboard than the test suite name, so we prefer to assert anything that might cause a segfault. I'll remove it if that's not an issue.

@azeey azeey force-pushed the sdf18_composition branch from 1041c6c to a1a1064 Compare June 3, 2021 16:06
Copy link
Contributor Author

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @sammy-tri)

a discussion (no related file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

nit CI is failing due to lint failures.

Can you fix this?

Done in a1a1064



multibody/parsing/test/detail_sdf_parser_test.cc, line 498 at r1 (raw file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

BTW Consider changing PlantAndSceneGraph to std::pair<...> so you could use a structured binding.

Done in a1a1064


multibody/parsing/test/detail_sdf_parser_test.cc, line 498 at r1 (raw file):

Previously, azeey (Addisu Z. Taddese) wrote…

I'm used to CI infrastructure where tests with segfaults end up with different names on the dashboard than the test suite name, so we prefer to assert anything that might cause a segfault. I'll remove it if that's not an issue.

Done in a1a1064

Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @sammy-tri)


multibody/parsing/test/detail_sdf_parser_test.cc, line 498 at r1 (raw file):

Previously, azeey (Addisu Z. Taddese) wrote…

Done in a1a1064

OK Thanks! I don't think I've seen it cause an issue with bazel's test logging, nor the jUnit stuff (either in Drake's CDash parsing, nor in Anzu Jenkin's jUnit parsing).

azeey added 2 commits June 3, 2021 12:18
Changes in behavior:
* Models nested via the `<include>` tag are no longer flattened, which
  means each included model will have its own model instance.
* `drake::multibody::Parser::AddAllModelsFromFile` now returns all added
  models including nested models

Note: This does not use a custom parser for URDFs via libsdformat's
Interface API, and thus may incur unexpected behavior when including
URDF files from SDFormat pending the full resolution of RobotLocomotion#14295.
Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

Reviewable status: LGTM missing from assignee sammy-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @EricCousineau-TRI and @sammy-tri)

a discussion (no related file):

Previously, EricCousineau-TRI (Eric Cousineau) wrote…

Working: Testing in Anzu CI.

OK Testing passed! Anzu PR 7073


Copy link
Contributor

@EricCousineau-TRI EricCousineau-TRI left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r2.
Reviewable status: LGTM missing from assignee sammy-tri(platform), commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @sammy-tri)

Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

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

:lgtm: (also based on reviewing the changes from the #14401 version)

Reviewable status: commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @sammy-tri)

@sammy-tri sammy-tri added the status: squashing now https://drake.mit.edu/reviewable.html#curated-commits label Jun 3, 2021
Copy link
Contributor

@sammy-tri sammy-tri left a comment

Choose a reason for hiding this comment

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

+(status: squashing now)

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees sammy-tri(platform),EricCousineau-TRI(platform) (waiting on @sammy-tri)

@sammy-tri sammy-tri merged commit 8d48ff9 into RobotLocomotion:master Jun 3, 2021
EricCousineau-TRI pushed a commit that referenced this pull request Jun 22, 2021
This removes additional implicit model frames created for nested models that were missed in #15099.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: squashing now https://drake.mit.edu/reviewable.html#curated-commits
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants