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

[multibody] MakeMobilizerForJoint() can now create Frames #22649

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

Conversation

sherm1
Copy link
Member

@sherm1 sherm1 commented Feb 18, 2025

Allows a joint to choose mobilizer F and M frames that are distinct from the joint's parent and child frames Jp and Jc. Demonstrates the capability by moving the Weld mobilizer F frame to be coincident with the M frame, even if Jp and Jc are not coincident, and strips the Weld mobilizer of its ability to model the F≠M case. Requires reaction force computation to understand whether Jc and M are the same because if not the reaction force must be shifted from the origin Mo of M to the origin Jco of Jc. Reverse welds must also be accommodated.

Existing tests in multibody_plant_test.cc already look at reaction forces for a variety of welds, reversed and with a general X_JpJc. Those fail without the reaction force changes here.

This does not include

This is the first PR in a series leading to MultibodyPlant taking advantage of optimal mobilizer frame choice for faster kinematics.

Notes for Release engineer

This is a change to the protected Joint API (added a parameter to pure virtual MakeMobilizerForJoint()). That only affects people who have written new Joint & Mobilizer types. If there are any non-Drake Joint extensions, they will need to add that parameter to the signature, although it can be ignored. Per our policy as stated in the Joint class header, the Joint protected API is subject to change without deprecation. However, we promise to note when changes have been made.

Resolves #22648


This change is Reviewable

@sherm1 sherm1 added priority: medium release notes: breaking change This pull request contains breaking changes labels Feb 18, 2025
Copy link
Member Author

@sherm1 sherm1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@amcastro-tri for feature review, please

Per earlier f2f, although MbT has inverse dynamics that returns M-frame reactions, I don't see a public MbP API that does so. The one that is there just returns taus. So as best I can tell the only place that cares if Jc != M is CalcReactionForces() which does promise to return reactions at Jc and expressed in Jc. PTAL

Reviewable status: LGTM missing from assignee amcastro-tri, needs platform reviewer assigned, needs at least two assigned reviewers

@sherm1 sherm1 force-pushed the mobilizer_optimal_frames branch from 939f510 to 147941b Compare February 19, 2025 00:16
@sherm1 sherm1 changed the title MakeMobilizerForJoint() can now create Frames [multibody] MakeMobilizerForJoint() can now create Frames Feb 19, 2025
@sherm1 sherm1 force-pushed the mobilizer_optimal_frames branch from 147941b to 89b754a Compare February 19, 2025 20:07
Copy link
Member Author

@sherm1 sherm1 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: 1 unresolved discussion, LGTM missing from assignee amcastro-tri, needs platform reviewer assigned, needs at least two assigned reviewers


multibody/tree/weld_mobilizer.h line 54 at r1 (raw file):

  // is always the identity transform since F==M by construction.
  math::RigidTransform<T> calc_X_FM(const T*) const {
    return math::RigidTransform<T>();

BTW @amcastro-tri where this is headed: this function will be replaced by inline operators that apply or compose with X_FM rather than returning it literally. In the case of weld those will be no-ops and generate no code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium release notes: breaking change This pull request contains breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drake joints should be able to create optimal F and M frames for speed
2 participants