-
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
pydrake systems: Expose initial round of different scalar types #8665
pydrake systems: Expose initial round of different scalar types #8665
Conversation
+@jwnimmer-tri for feature review, please. While the LOC is numerically high, most of the operations are very boiler-plate-y, and relatively simple. Review status: 0 of 17 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Jenkins has a complaint:
Comments from Reviewable |
Checkpoint. Reviewed 15 of 17 files at r1. bindings/pydrake/autodiffutils_py.cc, line 28 at r1 (raw file):
The three new lines in this file lack direct unit test coverage? bindings/pydrake/systems/framework_py_values.cc, line 27 at r1 (raw file):
Its difficult for me to immediately understand what passing a (Ditto for all the other bindings/pydrake/systems/primitives_py.cc, line 113 at r1 (raw file):
FYI Alpha-sort "Multiplexer" between "LinearSystem" and "Passthrough", for consistency? bindings/pydrake/systems/primitives_py.cc, line 120 at r1 (raw file):
Given that I suggest just saying bindings/pydrake/systems/systems_pybind.h, line 103 at r1 (raw file):
Either the above two lists are supposed to be identical to default_scalars.h in which case its a brittleness defect not to have cross-linked comments in the two files instructing developers to keep them in sync, or else these lists do not need to be kept in sync in which case its a confusion defect how and why these two lists should evolve differently. bindings/pydrake/systems/trajectory_optimization_py.cc, line 31 at r1 (raw file):
BTW If I'm understanding correctly, I think the important fact here is that the functions return references instead of copies. If that's what you mean, it probably should be made more obvious. bindings/pydrake/systems/test/general_test.py, line 47 at r1 (raw file):
What about the VectorBase / Supervector / Subvector? bindings/pydrake/systems/test/general_test.py, line 55 at r1 (raw file):
I don't understand what this is saying. bindings/pydrake/systems/test/general_test.py, line 61 at r1 (raw file):
As a basic sanity check, it seems worth checking some fact about the resulting system, e.g. that the num_inputs == 1 and input_port[0].size == 1, or similar. bindings/pydrake/systems/test/general_test.py, line 63 at r1 (raw file):
BTW typo bindings/pydrake/systems/test/general_test.py, line 82 at r1 (raw file):
BTW ... or else fail-fast (when T is neither of the two that its supposed to be?). bindings/pydrake/systems/test/primitives_test.py, line 65 at r1 (raw file):
Unclear why missing:
bindings/pydrake/util/cpp_template.py, line 169 at r1 (raw file):
FYI Should there be a unit test to make any assertions about the quality of the exception messages that are coming out related to this? tools/workspace/pybind11/repository.bzl, line 9 at r1 (raw file):
Blocking on reaching our master. Comments from Reviewable |
First pass complete. Reviewed 2 of 17 files at r1. bindings/pydrake/systems/framework_py_semantics.cc, line 52 at r1 (raw file):
I can't tease out why this moved, especially when BasicVectorPtrList didn't move. The prior location down below seems to be to be closer to its first point of use, which is more clear to the reader. bindings/pydrake/systems/framework_py_semantics.cc, line 149 at r1 (raw file):
FYI Just to double-check... you are okay losing this TODO? We'll figure it out once we need it, without any TODO reminder? bindings/pydrake/systems/framework_py_semantics.cc, line 273 at r1 (raw file):
It seems like we should have bindings/pydrake/systems/framework_py_systems.cc, line 176 at r1 (raw file):
FYI Since its not doxygen you don't need bindings/pydrake/systems/framework_py_systems.cc, line 289 at r1 (raw file):
I think ToAutoDiffXdMaybe and ToSymbolicMaybe are not tested? Comments from Reviewable |
…t conversion from double
3f13f6f
to
29bd40a
Compare
Review status: 10 of 22 files reviewed at latest revision, 19 unresolved discussions. bindings/pydrake/autodiffutils_py.cc, line 28 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/framework_py_semantics.cc, line 52 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Moved the binding for bindings/pydrake/systems/framework_py_semantics.cc, line 149 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK Yup. I should have removed it earlier; primarily because it's not needed since we get auto-downcasting wiht bindings/pydrake/systems/framework_py_systems.cc, line 176 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/framework_py_systems.cc, line 289 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/framework_py_values.cc, line 27 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK Would you like me to add some more doc to bindings/pydrake/systems/primitives_py.cc, line 113 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/primitives_py.cc, line 120 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/systems_pybind.h, line 103 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/trajectory_optimization_py.cc, line 31 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/test/general_test.py, line 47 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/test/general_test.py, line 55 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/test/general_test.py, line 63 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/test/general_test.py, line 82 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
…d11 uses overridden name in signatures
29bd40a
to
596da88
Compare
Addressed comments, PTAL. Review status: 10 of 24 files reviewed at latest revision, 17 unresolved discussions. bindings/pydrake/systems/framework_py_semantics.cc, line 273 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/test/general_test.py, line 61 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/systems/test/primitives_test.py, line 65 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. bindings/pydrake/util/cpp_template.py, line 169 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. See Comments from Reviewable |
99ac273
to
22aa489
Compare
22aa489
to
a219ea6
Compare
bindings/pydrake/systems/framework_py_values.cc, line 27 at r1 (raw file): Previously, EricCousineau-TRI (Eric Cousineau) wrote…
So is the bottom line here basically Comments from Reviewable |
+@SeanCurtis-TRI for platform review per schedule, please. Reviewed 13 of 14 files at r2, 2 of 2 files at r3. Comments from Reviewable |
Out of curiosity, is the python API documented somewhere? I'm particularly interested in the Reviewed 9 of 17 files at r1, 13 of 14 files at r2, 2 of 2 files at r3. Comments from Reviewable |
AFAIK we have http://drake.mit.edu/doxygen_cxx/python_bindings.html as a guide for developers of the python bindings and http://drake.mit.edu/python_bindings.html as documentation for users. |
Documenting the pattern for these templated classes would be a good thing there. It's something that isn't obviously pythonic. Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
a219ea6
to
e1f8b7a
Compare
Added docs on the pattern for template stuff. PTAL. Review status: 23 of 26 files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/systems/framework_py_values.cc, line 27 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
OK Yup. Added some docs to tools/workspace/pybind11/repository.bzl, line 9 at r1 (raw file): Previously, jwnimmer-tri (Jeremy Nimmer) wrote…
Done. Comments from Reviewable |
e1f8b7a
to
d22fd28
Compare
BTW While not completely pythonic, it has parallels to type hints introduce in Python3: Review status: 23 of 26 files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Reviewed 1 of 1 files at r4, 2 of 2 files at r5. Comments from Reviewable |
Great documentation. Just a couple of small editorial quibbles. Reviewed 1 of 1 files at r4, 2 of 2 files at r5. doc/python_bindings.rst, line 185 at r5 (raw file):
BTW "...has a user-defined number..." doc/python_bindings.rst, line 186 at r5 (raw file):
BTW s/summation/sum (sum is the value, summation is the process) doc/python_bindings.rst, line 193 at r5 (raw file):
Comments from Reviewable |
d22fd28
to
d294a0e
Compare
Review status: 25 of 26 files reviewed at latest revision, 3 unresolved discussions. doc/python_bindings.rst, line 185 at r5 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. doc/python_bindings.rst, line 186 at r5 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. doc/python_bindings.rst, line 193 at r5 (raw file): Previously, SeanCurtis-TRI (Sean Curtis) wrote…
Done. Thanks! Comments from Reviewable |
Reviewed 1 of 1 files at r6. Comments from Reviewable |
1 similar comment
Reviewed 1 of 1 files at r6. Comments from Reviewable |
Requires:
dtype=object
Can merge without, but would be nice to have:
This does not yet enable custom Python classes with scalar-type conversion. We can hack that in if need be, or wait for the above PRs to complete that.
\cc @RussTedrake @gizatt
This change is