-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 preliminary Python bindings and examples for systems framework. #7590
Add preliminary Python bindings and examples for systems framework. #7590
Conversation
ec458cf
to
005e836
Compare
005e836
to
54046ad
Compare
+@jadecastro for feature review (if you're comfortable reviewing the Python bindings) Review status: 0 of 16 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
69c0971
to
798474c
Compare
@drake-jenkins-bot mac-highsierra-clang-bazel-experimental please. |
Reviewed 16 of 16 files at r1. bindings/pydrake/systems/BUILD.bazel, line 29 at r1 (raw file):
BTW It is not clear to me what this means or what remains to do here. bindings/pydrake/systems/drawing.py, line 4 at r1 (raw file):
Is this a special pybind11 style of docstring? Some sort of passthrough to doxygen? bindings/pydrake/systems/framework_py.cc, line 60 at r1 (raw file):
This seems dangerous. Do we document anywhere the pitfalls that this might create? Alternatively, if we are happy with DeclareInputPort being public here, why not also in the superclass? Maybe it would make sense to export it with a _-prefixed name as is conventional in python for access-restricted fields. This might at least force non-subclass users to fight the linter. bindings/pydrake/systems/primitives_py.cc, line 35 at r1 (raw file):
Why only these? I suspect at least that anyone trying to use this will find themselves needing Multiplexer or Gain. You should at least TODO that some systems are missing here so people will know whether or not it is intentional and whether they should just add anything they need. bindings/pydrake/systems/test/custom_test.py, line 41 at r1 (raw file):
FYI -- This sounds like an issue that should have a bug number; consider filing it as a bug. bindings/pydrake/systems/test/general_test.py, line 75 at r1 (raw file):
FYI nobody is going to know what you mean by this, including probably you if you get back to this a year later. Comments from Reviewable |
798474c
to
1d8d72c
Compare
Review status: 10 of 18 files reviewed at latest revision, 6 unresolved discussions. bindings/pydrake/systems/BUILD.bazel, line 29 at r1 (raw file): Previously, ggould-tri wrote…
Done. bindings/pydrake/systems/drawing.py, line 4 at r1 (raw file): Previously, ggould-tri wrote…
Done. Nope, just me thinking in Bash mode. bindings/pydrake/systems/framework_py.cc, line 60 at r1 (raw file): Previously, ggould-tri wrote…
Done. Following PEP8 - thanks for catching that! bindings/pydrake/systems/primitives_py.cc, line 35 at r1 (raw file): Previously, ggould-tri wrote…
Done. (Added TODO.) bindings/pydrake/systems/test/custom_test.py, line 41 at r1 (raw file): Previously, ggould-tri wrote…
Done. (Just hadn't returned the right thing.) bindings/pydrake/systems/test/general_test.py, line 75 at r1 (raw file): Previously, ggould-tri wrote…
Done. Comments from Reviewable |
Nice; I like the new test especially. Reviewed 8 of 8 files at r2. Comments from Reviewable |
1d8d72c
to
cf8367a
Compare
@drake-jenkins-bot mac-highsierra-clang-bazel-experimental please. |
Reviewed 1 of 1 files at r3. Comments from Reviewable |
Pass complete. Reviewed 15 of 16 files at r1, 4 of 8 files at r2, 1 of 1 files at r3. bindings/pydrake/systems/drawing.py, line 1 at r1 (raw file):
bindings/pydrake/systems/drawing.py, line 25 at r1 (raw file):
BTW, rather than this, you may as well consider just summarizing the gist of this comment, specific to what's in the code below. bindings/pydrake/systems/framework_py.cc, line 7 at r2 (raw file):
BTW, Is this unused? bindings/pydrake/systems/test/custom_test.py, line 81 at r2 (raw file):
Since Simulator does not own the Diagram context, does it now share it? If so, shall a test be added to test the equivalent of bindings/pydrake/systems/test/graphviz_example.py, line 25 at r1 (raw file):
BTW, Is there any tests to be checked here? Or is this purely for tutorial value? Comments from Reviewable |
ccebec4
to
9939c92
Compare
Reviewed 5 of 5 files at r4. bindings/pydrake/systems/drawing.py, line 1 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
That doesn't seem right to me. There's no main in here, so it's not executable and a shebang line would just confuse matters. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions. bindings/pydrake/systems/drawing.py, line 1 at r1 (raw file): Previously, ggould-tri wrote…
I see. Thanks. Comments from Reviewable |
9939c92
to
39ed50e
Compare
@drake-jenkins-bot mac-highsierra-clang-bazel-experimental please. |
Review status: 17 of 18 files reviewed at latest revision, 5 unresolved discussions. bindings/pydrake/systems/drawing.py, line 1 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
BTW Would you be able to mark yourself as satisfied? bindings/pydrake/systems/drawing.py, line 25 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. bindings/pydrake/systems/framework_py.cc, line 7 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. bindings/pydrake/systems/test/custom_test.py, line 81 at r2 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
Done. Added this into bindings/pydrake/systems/test/graphviz_example.py, line 25 at r1 (raw file): Previously, jadecastro (Jonathan DeCastro) wrote…
It's just for tutorial value. I've added a TODO in Comments from Reviewable |
Reviewed 1 of 1 files at r5. Comments from Reviewable |
Review status: all files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
This is the initial binding of a small portion of the Systems framework in Python.
Introduces:
ExampleDiagram
(//systems/framework:diagram_test
)pydot
is installed.unique_ptr
(to concretely track capabilities, if/when we decide to switch toshared_ptr
s)Caveats at present:
VectorBase
, noAbstractValue
s, a small subset of primitives).unique_ptr
s back and forth; I need to minimize the changes made (as WIP: Support ownership transfer between C++ and Python withshared_ptr<T>
andunique_ptr<T>
for pure C++ instances and single-inheritance instances pybind/pybind11#1146 is still in flight, and may end up being broken up, if it is able to land).Tasks:
shared_ptr<T>
andunique_ptr<T>
for pure C++ instances and single-inheritance instances pybind/pybind11#1146 into RobotLocomotion/pybind11.shared_ptr<T>
andunique_ptr<T>
for pure C++ instances and single-inheritance instances pybind11#2 and Hotfix: Rebase PR #2 pybind11#3. Will remove "do not merge"if/when this landsonce Mac tests pass.pybind11
, if possible.keep_alive
semantics are upheld)Add a test / example with an IPython notebook- slatedThis change is