-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 parsing of custom drake:mimic tag for SDFormat #20503
[parsing] Add parsing of custom drake:mimic tag for SDFormat #20503
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+@rpoyner-tri for feature review, please.
Reviewable status: LGTM missing from assignee rpoyner-tri(platform), needs at least two assigned reviewers
d3174a7
to
4bdf737
Compare
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
} }
FYI: I had to pull out the <mimic>
tag parsing to after all of the joints were parsed because the parser would fail if a <mimic>
tag specified a joint that had yet to be created in the plant.
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
Previously, joemasterjohn (Joe Masterjohn) wrote…
FYI: I had to pull out the
<mimic>
tag parsing to after all of the joints were parsed because the parser would fail if a<mimic>
tag specified a joint that had yet to be created in the plant.
I'm looking for evidence that this behavior is part of the URDF spec, and so far, I'm not finding any. Granted, the URDF spec is pretty loose, but I'm not sure it's a win to encourage people to write URDF that is not portable.
Is there a reason we actually need forward reference here?
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
Previously, rpoyner-tri (Rick Poyner (rico)) wrote…
I'm looking for evidence that this behavior is part of the URDF spec, and so far, I'm not finding any. Granted, the URDF spec is pretty loose, but I'm not sure it's a win to encourage people to write URDF that is not portable.
Is there a reason we actually need forward reference here?
The coupler constraint cannot be created in the plant (the last step of the parsing) until both joints exist in the plant. The current flow of the parser goes node by node (ordered by where they're defined in the file) creating joints and parsing all of its elements (including ) . So if a joint exists earlier in the file and in its tag references a joint defined a few lines below the current parser blows up. I don't think that should be an error to forward reference a joint defined later in the file, right?
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
Previously, joemasterjohn (Joe Masterjohn) wrote…
The coupler constraint cannot be created in the plant (the last step of the parsing) until both joints exist in the plant. The current flow of the parser goes node by node (ordered by where they're defined in the file) creating joints and parsing all of its elements (including ) . So if a joint exists earlier in the file and in its tag references a joint defined a few lines below the current parser blows up. I don't think that should be an error to forward reference a joint defined later in the file, right?
Sorry I didn't code
escape the tags I was talking about. (I meanto to say: including <mimic>
).
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
Previously, joemasterjohn (Joe Masterjohn) wrote…
Sorry I didn't
code
escape the tags I was talking about. (I meanto to say: including<mimic>
).
I've been looking for existing URDF files in the world that use forward reference for mimic
, and I can't find any. IIRC, joint parent
and child
don't support forward reference. Why should mimic be any different in that regard? I don't think there's any particular mathematical or robot design reason to support forward reference.
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
IIRC, joint
parent
andchild
don't support forward reference.
Do you mean that the URDF spec specifies that forward reference is not supported? Drake's URDF parser supports forward reference of parent
or child
(all link
elements are parsed before any joint
or drake:joint
elements.)
There was a problem hiding this 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 rpoyner-tri(platform), needs at least two assigned reviewers
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
Previously, joemasterjohn (Joe Masterjohn) wrote…
IIRC, joint
parent
andchild
don't support forward reference.Do you mean that the URDF spec specifies that forward reference is not supported? Drake's URDF parser supports forward reference of
parent
orchild
(alllink
elements are parsed before anyjoint
ordrake:joint
elements.)
The URDF "spec" doesn't say much. My concern is that we encourage people to write non-portable files. However, if someone does that, the fixes are easy: either swap the joint definitions, or invert the mimic tag and its math. I suppose it is fine to support forward reference for mimic, but I can't really find any evidence for calling non-support of it a "bug".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: 3 unresolved discussions, needs at least two assigned reviewers
-- commits
line 5 at r1:
nit consider dropping the "bug" language here, and instead say "extends the parser" or similar.
multibody/parsing/test/detail_sdf_parser_test.cc
line 993 at r1 (raw file):
} TEST_F(SdfParserTest, MimicSuccessfulParsing) {
minor consider adding a test case that successfully parses a mimic with backward reference, which is by far the more common case in models found in the wild.
multibody/parsing/test/urdf_parser_test/joint_parsing_test.urdf
line 141 at r1 (raw file):
<parent link="link10"/> <child link="link11"/> </joint>
minor consider adding test data for a mimic with backward reference, which is by far the more common case in models found in the wild.
4bdf737
to
c151d1e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @rpoyner-tri. +@sammy-tri for platform review, please.
Reviewable status: LGTM missing from assignee sammy-tri(platform)
Previously, rpoyner-tri (Rick Poyner (rico)) wrote…
nit consider dropping the "bug" language here, and instead say "extends the parser" or similar.
Done.
multibody/parsing/detail_urdf_parser.cc
line 1064 at r1 (raw file):
Previously, rpoyner-tri (Rick Poyner (rico)) wrote…
The URDF "spec" doesn't say much. My concern is that we encourage people to write non-portable files. However, if someone does that, the fixes are easy: either swap the joint definitions, or invert the mimic tag and its math. I suppose it is fine to support forward reference for mimic, but I can't really find any evidence for calling non-support of it a "bug".
OK, I'll remove the language calling this a bug fix.
multibody/parsing/test/detail_sdf_parser_test.cc
line 993 at r1 (raw file):
Previously, rpoyner-tri (Rick Poyner (rico)) wrote…
minor consider adding a test case that successfully parses a mimic with backward reference, which is by far the more common case in models found in the wild.
Done.
multibody/parsing/test/urdf_parser_test/joint_parsing_test.urdf
line 141 at r1 (raw file):
Previously, rpoyner-tri (Rick Poyner (rico)) wrote…
minor consider adding test data for a mimic with backward reference, which is by far the more common case in models found in the wild.
Done.
c151d1e
to
3c89781
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: LGTM missing from assignee sammy-tri(platform)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r2, all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform)
multibody/parsing/detail_sdf_parser.cc
line 678 at r2 (raw file):
"drake:gear_ratio", "drake:controller_gains", "drake:mimic",
I think this custom element deserves a mention in parsing_doxygen.h
https://github.com/RobotLocomotion/drake/blob/master/multibody/parsing/parsing_doxygen.h#L136 (it might also be worth documenting that joints can only mimic another joint in the same model instance)
There was a problem hiding this 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)
multibody/parsing/detail_sdf_parser.cc
line 678 at r2 (raw file):
Previously, sammy-tri (Sam Creasey) wrote…
I think this custom element deserves a mention in
parsing_doxygen.h
https://github.com/RobotLocomotion/drake/blob/master/multibody/parsing/parsing_doxygen.h#L136 (it might also be worth documenting that joints can only mimic another joint in the same model instance)
Working. I though I already commited the doxygen addition, but I must have lost it in a rebase or something 🤦
Also extends the URDF parser to support <mimic> elements that specify a joint that is defined after the <joint> the tag is a member of.
3c89781
to
5391542
Compare
There was a problem hiding this 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)
multibody/parsing/detail_sdf_parser.cc
line 678 at r2 (raw file):
Previously, joemasterjohn (Joe Masterjohn) wrote…
Working. I though I already commited the doxygen addition, but I must have lost it in a rebase or something 🤦
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),sammy-tri(platform)
sorry I didn't chime in sooner (I just noticed this after it was merged), but you might consider using the
|
Adds a custom
drake:mimic
tag for SDFormat with semantics analogous to the already supported<mimic>
tag in URDF.This change is