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

[py systems] Change how ValueProducer callbacks work #22470

Merged

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented Jan 15, 2025

(1) Add better error reporting in case the user's function is incorrectly implemented or otherwise misbehaves.

(2) Don't rely on pybind11 to cast the result of allocate() to a unique_ptr (this is an RLG/pybind11-specific feature).

Towards #21968.


This change is Reviewable

@jwnimmer-tri jwnimmer-tri added priority: low release notes: none This pull request should not be mentioned in the release notes labels Jan 15, 2025
@jwnimmer-tri jwnimmer-tri force-pushed the value-producer-pybind branch from 14c394c to 829f00c Compare January 15, 2025 21:16
@sherm1
Copy link
Member

sherm1 commented Jan 15, 2025

Do you want to assign a feature reviewer for this, Jeremy?

@jwnimmer-tri
Copy link
Collaborator Author

Sadly, I think we need to pile another feature review on +@rpoyner-tri, unless @EricCousineau-TRI wants to jump in? This can wait until next week, it's not blocking anything.

Copy link
Contributor

@EricCousineau-TRI EricCousineau-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, can also serve as platform if desired - thanks!

Reviewed 8 of 8 files at r1.
Reviewable status: LGTM missing from assignee rpoyner-tri(platform), needs at least two assigned reviewers

@jwnimmer-tri
Copy link
Collaborator Author

Thanks! I think extra eyes are good in this case, so +@SeanCurtis-TRI for platform per schedule, please.

Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-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 8 of 8 files at r1, all commit messages.
Reviewable status: 1 unresolved discussion


bindings/pydrake/systems/value_producer_pybind.cc line 6 at r1 (raw file):

namespace pydrake {

// The C++ framework uses ValueProducer::AllocateCallback to allocate storage

nit: This is copied verbatim from the header. Do you want it both places?

(1) Add better error reporting in case the user's function is
incorrectly implemented or otherwise misbehaves.

(2) Don't rely on pybind11 to cast the result of allocate() to a
unique_ptr (this is an RLG/pybind11-specific feature).
@jwnimmer-tri jwnimmer-tri force-pushed the value-producer-pybind branch from 829f00c to 16c09a0 Compare January 16, 2025 20:58
Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-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 r2, all commit messages.
Reviewable status: 1 unresolved discussion

@jwnimmer-tri jwnimmer-tri merged commit 20ab86b into RobotLocomotion:master Jan 17, 2025
10 checks passed
@jwnimmer-tri jwnimmer-tri deleted the value-producer-pybind branch January 17, 2025 00:31
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.

5 participants