[multibody] Throw if CalcSpatialInertia frame is not in the plant - #24934
[multibody] Throw if CalcSpatialInertia frame is not in the plant#24934castor639 wants to merge 2 commits into
Conversation
Validate that frame_F belongs to this MultibodyTree before computing spatial inertia, so an unowned FixedOffsetFrame throws instead of segfaulting. Fixes RobotLocomotion#22636.
|
+(release notes: fix) +a:@SeanCurtis-TRI |
SeanCurtis-TRI
left a comment
There was a problem hiding this comment.
+(status: single reviewer ok)
@SeanCurtis-TRI reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status:complete! all discussions resolved, LGTM from assignee SeanCurtis-TRI(platform) (waiting on castor639).
|
@drake-jenkins-bot test this please |
SeanCurtis-TRI
left a comment
There was a problem hiding this comment.
@SeanCurtis-TRI made 1 comment.
Reviewable status: 1 unresolved discussion (waiting on castor639).
multibody/plant/multibody_plant.h line 4165 at r1 (raw file):
/// @param[in] context Contains the configuration of the set S of bodies. /// @param[in] frame_F specifies the about-point Fo (frame_F's origin) and /// the expressed-in frame for the returned spatial inertia.
nit: CI is failling because this change to the header requires a rebuild of drake docs:
bazel run //bindings/generated_docstrings:regenerate
Then include the changed file in this commit.
SeanCurtis-TRI
left a comment
There was a problem hiding this comment.
@SeanCurtis-TRI reviewed 1 file and all commit messages.
Reviewable status: 1 unresolved discussion, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on castor639).
|
@drake-jenkins-bot retest this please |
SeanCurtis-TRI
left a comment
There was a problem hiding this comment.
CI Failure in //multibody/plant:fused_welds_test. That body was not expecting the newly introduced throw. The FusedTest.CompositeSpatialInertia test needs to be updated.
@SeanCurtis-TRI made 2 comments.
Reviewable status: 2 unresolved discussions, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on castor639).
multibody/plant/test/multibody_plant_momentum_energy_test.cc line 340 at r2 (raw file):
"CalcSpatialInertia\\(\\): contains a repeated BodyIndex.*"); // Verify an exception is thrown if frame_F was never added to the plant
nit: Failure based on introduction of lint on this file. FIx via:
bazel-bin/tools/lint/clang-format -style=file -i multibody/plant/test/multibody\_plant\_momentum\_energy\_test.cc
Validate that frame_F belongs to this MultibodyTree before computing spatial inertia, so an unowned FixedOffsetFrame throws instead of segfaulting.
Fixes #22636.
This change is