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] Slightly improve joint parsing diagnostics #17054

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Apr 27, 2022

Mostly, just clarify our plans for future work, and be sure to notice when SDFormat adds new joint types (via C++ switch-enum warnings).

To provide more context for the TODOs -- as discussed in slack, to the extent that we can best-effort deal with unimplemented features (while warning about it to the user), that is probably the best UX. It will allow the user to actually create a MbP and play with it, resolving the warnings later in due course.

Closes #16784.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri marked this pull request as ready for review April 27, 2022 21:19
@jwnimmer-tri
Copy link
Collaborator Author

+@sammy-tri for feature review, please.

@jwnimmer-tri jwnimmer-tri added the release notes: none This pull request should not be mentioned in the release notes label Apr 27, 2022
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: +@xuchenhan-tri for platform review by rotation (Monday)

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: LGTM missing from assignee xuchenhan-tri(platform) (waiting on @xuchenhan-tri)

Copy link
Contributor

@xuchenhan-tri xuchenhan-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 1 of 1 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee xuchenhan-tri(platform) (waiting on @jwnimmer-tri)


-- commits line 5 at r1:
BTW, why is switch enum warning preferred to the default throw approach used before?


multibody/parsing/detail_sdf_parser.cc line 621 at r1 (raw file):

    case sdf::JointType::CONTINUOUS: {
      // TODO(#14747) Use an unlimited multibody::RevoluteJoint here.
      diagnostic.Error(fmt::format(

nit, are these covered by unit tests?

Mostly, just clarify our plans for future work, and be sure to notice
when SDFormat adds new joint types (via C++ switch-enum warnings).
@jwnimmer-tri jwnimmer-tri force-pushed the parsing-joint-clarity branch from e71cbbe to c8bf4e6 Compare April 29, 2022 19:39
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-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 xuchenhan-tri(platform) (waiting on @sammy-tri and @xuchenhan-tri)


-- commits line 5 at r1:

Previously, xuchenhan-tri wrote…

BTW, why is switch enum warning preferred to the default throw approach used before?

When code uses a switch() statement over an enum and the switch does not contain a default: case, then the compiler will emit a warning about any enum values that have not been mentioned as cases. In Drake's build settings, we promote that warning to an error.

This means that is upstream libsdformat ever adds a new enumeration value, Drake developers will be forced to explicitly consider what we should do about it, because CI will bark during the libsdformat pin upgrade.


multibody/parsing/detail_sdf_parser.cc line 621 at r1 (raw file):

Previously, xuchenhan-tri wrote…

nit, are these covered by unit tests?

Done.

Copy link
Contributor

@xuchenhan-tri xuchenhan-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:

Reviewed 2 of 2 files at r2, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees sammy-tri(platform),xuchenhan-tri(platform) (waiting on @jwnimmer-tri)


-- commits line 5 at r1:

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

When code uses a switch() statement over an enum and the switch does not contain a default: case, then the compiler will emit a warning about any enum values that have not been mentioned as cases. In Drake's build settings, we promote that warning to an error.

This means that is upstream libsdformat ever adds a new enumeration value, Drake developers will be forced to explicitly consider what we should do about it, because CI will bark during the libsdformat pin upgrade.

Nice, thanks for the explanation

@xuchenhan-tri xuchenhan-tri merged commit f5b6c04 into RobotLocomotion:master Apr 29, 2022
@jwnimmer-tri jwnimmer-tri deleted the parsing-joint-clarity branch May 11, 2022 04:02
aykut-tri pushed a commit to aykut-tri/drake that referenced this pull request May 27, 2022
…#17054)

* [parsing] Slightly improve joint parsing diagnostics

Mostly, just clarify our plans for future work, and be sure to notice
when SDFormat adds new joint types (via C++ switch-enum warnings).
aykut-tri pushed a commit to aykut-tri/drake that referenced this pull request Jun 1, 2022
…#17054)

* [parsing] Slightly improve joint parsing diagnostics

Mostly, just clarify our plans for future work, and be sure to notice
when SDFormat adds new joint types (via C++ switch-enum warnings).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: none This pull request should not be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDFormat parser: support first-class feedback channel
3 participants