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

Add template for GetScopedFrameByName #22590

Open
marip8 opened this issue Feb 5, 2025 · 0 comments
Open

Add template for GetScopedFrameByName #22590

marip8 opened this issue Feb 5, 2025 · 0 comments
Assignees
Labels

Comments

@marip8
Copy link

marip8 commented Feb 5, 2025

Is your feature request related to a problem? Please describe.

I have written a few custom constraint evaluators that need to extract a Frame from a MultibodyPlant of type AutoDiffXd. When using these constraint evaluators with more complex plants with nested models, I hoped to use the GetScopedFrameByName utility but found that (as of v1.36.0) it only works with plants of type double.

Describe the solution you'd like
It would be helpful for the GetScopedFrameByName utilities to be template functions that work with all plant types.

- const drake::multibody::Frame<double>* GetScopedFrameByNameMaybe(
+ template<typename T>
+ const drake::multibody::Frame<T>* GetScopedFrameByNameMaybe(
-    const drake::multibody::MultibodyPlant<double>& plant,
+    const drake::multibody::MultibodyPlant<T>& plant,
    const std::string& full_name);

- const drake::multibody::Frame<double>& GetScopedFrameByName(
+ template<typename T>
+ const drake::multibody::Frame<T>& GetScopedFrameByName(
-    const drake::multibody::MultibodyPlant<double>& plant,
+    const drake::multibody::MultibodyPlant<T>& plant,
    const std::string& full_name);

I personally am also using the Python interface, so it would also be helpful for this change to propagate there too.

Describe alternatives you've considered
I'm currently writing my own helper function to do this, but it would be cleaner for this functionality to exist out of the box with Drake

Additional context

Related to #15660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants