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

Improve error message when MbP meets unknown geometries #22178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xuchenhan-tri
Copy link
Contributor

@xuchenhan-tri xuchenhan-tri commented Nov 14, 2024

Closes #22164.


This change is Reviewable

@jwnimmer-tri

This comment was marked as outdated.

@xuchenhan-tri xuchenhan-tri force-pushed the non-mbp-geometry-id branch 2 times, most recently from 6605ca3 to 25c83b4 Compare November 14, 2024 23:45
@xuchenhan-tri xuchenhan-tri added priority: low release notes: fix This pull request contains fixes (no new features) labels Nov 14, 2024
Copy link
Contributor Author

@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.

+(release notes: fix) +(priority: low) +@jwnimmer-tri for feature review when you have time.

Reviewable status: LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers

Copy link
Collaborator

@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.

Reviewed 5 of 9 files at r1, 1 of 2 files at r2, all commit messages.
Reviewable status: 3 unresolved discussions, LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers


multibody/plant/discrete_update_manager.h line 247 at r2 (raw file):

  /* Private MultibodyPlant method, made public here. */
  BodyIndex FindBodyByGeometryId(geometry::GeometryId geometry_id) const;

nit On a fresh reading, it seems to me like this declaration should live within the Doxygen group on lines 215-230? (I think maybe the EvalGeometryContactData ended up in the wrong place earlier, too.)


multibody/plant/test/discrete_update_manager_test.cc line 447 at r2 (raw file):

  Parser parser(&plant, &scene_graph);
  parser.AddModelsFromUrl("package://drake_models/skydio_2/quadrotor.urdf");

I am little bit hesitant to use a model file that's not super related to this test. If we ever change the model file for other reasons, this test could be unnecessarily affected.

WDYT about something like multibody/models/box.urdf instead?


multibody/plant/multibody_plant.cc line 1660 at r2 (raw file):

  if (!geometry_id.is_valid()) {
    throw std::logic_error(
        "MultibodyPlant::FindBodyByGeometryId received an invalid GeometryId");

I don't think using the name of a private method in exception text is particularly helpful to users (and usually we try to avoid doing that).

The existing message was not too bad so I would be OK leaving it alone. If we wanted to try to improve its clarity, the things we could try to highlight more would be that the geometries we're talking about here are for collision pairs reported by the scene graph that's connected to our query input port.

Copy link
Contributor Author

@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.

Reviewable status: LGTM missing from assignee jwnimmer-tri(platform), needs at least two assigned reviewers


multibody/plant/discrete_update_manager.h line 247 at r2 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

nit On a fresh reading, it seems to me like this declaration should live within the Doxygen group on lines 215-230? (I think maybe the EvalGeometryContactData ended up in the wrong place earlier, too.)

Good call, Done.


multibody/plant/multibody_plant.cc line 1660 at r2 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

I don't think using the name of a private method in exception text is particularly helpful to users (and usually we try to avoid doing that).

The existing message was not too bad so I would be OK leaving it alone. If we wanted to try to improve its clarity, the things we could try to highlight more would be that the geometries we're talking about here are for collision pairs reported by the scene graph that's connected to our query input port.

Done, PTAL.


multibody/plant/test/discrete_update_manager_test.cc line 447 at r2 (raw file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

I am little bit hesitant to use a model file that's not super related to this test. If we ever change the model file for other reasons, this test could be unnecessarily affected.

WDYT about something like multibody/models/box.urdf instead?

My thought process was that quadrotor.urdf is a model of an actual hardware so it's less prone to significant hange (e.g. like iiwa and pandas). But after looking more closely, it seems like it's a crude model properly put together for demo purposes?

Copy link
Collaborator

@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.

:lgtm: feature.

Reviewed 6 of 6 files at r3, all commit messages.
Reviewable status: needs at least two assigned reviewers


multibody/plant/test/discrete_update_manager_test.cc line 447 at r2 (raw file):

Previously, xuchenhan-tri wrote…

My thought process was that quadrotor.urdf is a model of an actual hardware so it's less prone to significant hange (e.g. like iiwa and pandas). But after looking more closely, it seems like it's a crude model properly put together for demo purposes?

I don't know that I can speak to the quadrotor's provenance, but in any case I think using a multibody-test-local model is a nice improvement anyway.

Copy link
Contributor Author

@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.

+@sammy-tri for platform review on Monday per rotation please.

Reviewable status: LGTM missing from assignee sammy-tri(platform)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: fix This pull request contains fixes (no new features)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DiscreteUpdateManager::AppendDiscreteContactPairsForPointContact assumes that it owns all of the geometry
3 participants