Skip to content

Spike test extent to which Python can use the existing System framework #7185

@EricCousineau-TRI

Description

@EricCousineau-TRI

This is meant to spike test the extent to which Python can use the existing Systems framework.

From Robin's initial prototype with pybind11 and the follow-up implementations Drake now has, it seems like pybind11 should be able to handle most of the basic API.

I've only hit two main sticking points thus far:

  • Taking ownership of Python-created objects in C++ - the use of std::unique_ptr<> may provide some barriers to easily taking ownership of Python-created objects. Discussion from pybind11 here, an example repro here (comparing unique_ptr and shared_ptr destruction).
  • Templates (scalar type conversion) - a messy prototype is available here. This seems rough, but achievable, but runs into issues with the above issue on std::unique_ptr<> (specifically, when trying to have Python-defined Converter<> functions passed back to BaseConverter - for testing Python-defined classes).

Motivation for both of these:

  • Templates / scalar type conversion - also for handling Value<T> instances for AbstractValues
  • std::unique_ptr - Ensure that we can properly construct diagrams, create model values, do cloning, etc.

@RussTedrake - can I ask if you had run into any of these issues when you were prototyping these things?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions