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
Add parsing for reflected inertia parameters #14323
Add parsing for reflected inertia parameters #14323
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.
+@EricCousineau-TRI for feature review, please.
Reviewable status: LGTM missing from assignee EricCousineau-TRI(platform), needs at least two assigned reviewers (waiting on @EricCousineau-TRI)
4d7a20c
to
13c57b6
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.
@EricCousineau-TRI: One question I had before you started reviewing was where would be the right place in public doxygen to share how custom tags should be formatted for both URDF and SDF?
Reviewable status: LGTM missing from assignee EricCousineau-TRI(platform), needs at least two assigned reviewers (waiting on @EricCousineau-TRI)
13c57b6
to
0bfeaee
Compare
Er, good question on where to document this. At present, we don't have any existing centralized docs (see #13314 and #14107). My suggestions:
FYI @SeanCurtis-TRI |
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 4 of 4 files at r1.
Reviewable status: 2 unresolved discussions, needs at least two assigned reviewers (waiting on @joemasterjohn)
multibody/parsing/detail_urdf_parser.cc, line 572 at r1 (raw file):
if (rotor_inertia_node) { double rotor_inertia; if (!ParseScalarAttribute(rotor_inertia_node, "value", &rotor_inertia)) {
BTW I confirmed that the use of <tag>{value}</tag>
in SDFormat and <tag value="{value}"/>
in URDF is consistent with the hydroelastic tags.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1147 at r1 (raw file):
auto [plant, scene_graph] = ParseTestString(R"( <model name='ReflectedInertiaModel'> <link name='A'/>
nit Please use either '
or "
consistently within one document.
multibody/parsing/test/detail_urdf_parser_test.cc, line 742 at r1 (raw file):
<?xml version="1.0"?> <robot name=""> <link name="A"></link>
nit Above this, <link name="X"/>
is used, rather than <link name="X"></link>
.
0bfeaee
to
1885e28
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 @EricCousineau-TRI. Comments addressed.
@rpoyner-tri and I talked about the possibility of your first suggestion. For now, I've added it as an item in the TODO list on #13314 and hopefully all custom tags can be consolidated at once.
Reviewable status: needs at least two assigned reviewers (waiting on @EricCousineau-TRI)
multibody/parsing/detail_urdf_parser.cc, line 572 at r1 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
BTW I confirmed that the use of
<tag>{value}</tag>
in SDFormat and<tag value="{value}"/>
in URDF is consistent with the hydroelastic tags.
Thanks. I think I saw that convention when adding the bushing tags, and followed my nose here.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1147 at r1 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
nit Please use either
'
or"
consistently within one document.
Done. Thanks, I was being sloppy.
multibody/parsing/test/detail_urdf_parser_test.cc, line 742 at r1 (raw file):
Previously, EricCousineau-TRI (Eric Cousineau) wrote…
nit Above this,
<link name="X"/>
is used, rather than<link name="X"></link>
.
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.
+@jwnimmer-tri for platform review, please.
Reviewable status: LGTM missing from assignee jwnimmer-tri(platform) (waiting on @EricCousineau-TRI and @jwnimmer-tri)
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.
One of my OKRs is to solve the question of how does the relevant documentation get exposed to the real world. It's a non-trivial problem based on several desirable but mutually exclusive constraints. If you solve it before I do, I'll steal your answer. If I solve it before you do, feel free to steal my answer.
If you just want to create an issue relating to the discoverability of MBP documentation (akin to geometry's -- e.g., #14107 and #13314) and defer it, I'd be ok with that.
Reviewable status: LGTM missing from assignee jwnimmer-tri(platform) (waiting on @EricCousineau-TRI and @jwnimmer-tri)
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 jwnimmer-tri(platform) (waiting on @EricCousineau-TRI and @jwnimmer-tri)
multibody/parsing/detail_urdf_parser.cc, line 572 at r1 (raw file):
Previously, joemasterjohn (Joe Masterjohn) wrote…
Thanks. I think I saw that convention when adding the bushing tags, and followed my nose here.
As long as I keep getting burned by this, I'll keep adding gentle reminders.
When using "BTW" or "FYI", reviewable sets your status to "informing". That means it wants acknowledgment from everyone who is part of the review (putting red on my dashboard). If you explicitly set your self to discussing when using one of those shorthands, then it's kept between you and the author.
This has been your BTW PSA for today.
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 2 of 4 files at r1, 2 of 2 files at r2.
Reviewable status: 4 unresolved discussions (waiting on @joemasterjohn)
multibody/parsing/detail_sdf_parser.cc, line 256 at r2 (raw file):
} drake::log()->trace("sdf_parser: Add JointActuator parameters.");
What is this logging for? It's logging anytime we add an actuator, but claims to be logging that we've added the parameters which we might have not, if the if-checks were false.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1143 at r2 (raw file):
GTEST_TEST(SdfParser, ReflectedInertiaParametersParsing) { // Test successful parsing of both parameters
nit Missing punctuation.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1145 at r2 (raw file):
// Test successful parsing of both parameters { auto [plant, scene_graph] = ParseTestString(R"(
nit See https://drake.mit.edu/styleguide/cppguide.html#Raw_String_Literals for required formatting that's missing here (and the rest of the new code, below).
multibody/parsing/test/detail_sdf_parser_test.cc, line 1161 at r2 (raw file):
<drake:gear_ratio>300.0</drake:gear_ratio> </joint> </model>)");
BTW There is enough large boilerplate here (3x) that using a fmt
string for this literal would help cut it down a lot (with a {}
placeholder for the variable content, to be substituted for each test case).
multibody/parsing/test/detail_urdf_parser_test.cc, line 737 at r2 (raw file):
GTEST_TEST(MultibodyPlantUrdfParserTest, ReflectedInertiaParametersParsing) { // Test successful parsing of both parameters
nit Missing punctuation.
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 (waiting on @jwnimmer-tri)
multibody/parsing/detail_sdf_parser.cc, line 256 at r2 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
What is this logging for? It's logging anytime we add an actuator, but claims to be logging that we've added the parameters which we might have not, if the if-checks were false.
Done. I was using it for debugging, but it's not being used. Removed.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1143 at r2 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
nit Missing punctuation.
Done.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1145 at r2 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
nit See https://drake.mit.edu/styleguide/cppguide.html#Raw_String_Literals for required formatting that's missing here (and the rest of the new code, below).
Done.
multibody/parsing/test/detail_sdf_parser_test.cc, line 1161 at r2 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
BTW There is enough large boilerplate here (3x) that using a
fmt
string for this literal would help cut it down a lot (with a{}
placeholder for the variable content, to be substituted for each test case).
Done.
multibody/parsing/test/detail_urdf_parser_test.cc, line 737 at r2 (raw file):
Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
nit Missing punctuation.
Done.
1885e28
to
c504fff
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 3 of 3 files at r3.
Reviewable status: complete! all discussions resolved, LGTM from assignees jwnimmer-tri(platform),EricCousineau-TRI(platform)
I wonder ... if given a second chance, in our SDFormat customization would we have rather put these custom elements under |
Modifies the SDF and URDF parser to take two custom tags:
drake:rotor_inertia
drake:gear_ratio
Used to set
JointActuator::default_rotor_inertia_
andJointActuator::default_gear_ratio_
.In SDF, these custom tags are expected to appear within the
<joint>
tag, e.g.:In URDF, these custom tags are expected to appear within the
<actuator>
tag within a<transmission>
tag, e.g.:Related to #12335
This change is