-
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
initial bindings for pendulum example #7766
Conversation
3319163
to
59c9f29
Compare
+@EricCousineau-TRI for feature review, please Comments from Reviewable |
Reviewed 5 of 5 files at r1. bindings/pydrake/examples/BUILD.bazel, line 36 at r1 (raw file):
BTW The comment about Comments from Reviewable |
59c9f29
to
b80b80a
Compare
Review status: all files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/BUILD.bazel, line 36 at r1 (raw file): Previously, EricCousineau-TRI wrote…
Done. Is that what you meant? Comments from Reviewable |
b80b80a
to
d843b61
Compare
Review status: 3 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks pending. bindings/pydrake/examples/BUILD.bazel, line 36 at r1 (raw file): Previously, RussTedrake (Russ Tedrake) wrote…
Yup! bindings/pydrake/examples/BUILD.bazel, line 79 at r2 (raw file):
BTW Is the bindings/pydrake/examples/test/pendulum_test.py, line 47 at r2 (raw file):
Whitespace and comments from WIP commit? Comments from Reviewable |
doh. i just force-pushed some old code and blew away some changes. will push my clean copy from home tonight. Comments from Reviewable |
d843b61
to
d06c059
Compare
d06c059
to
6f45d05
Compare
ok. fixed now. ptal? Review status: 3 of 5 files reviewed at latest revision, 2 unresolved discussions. bindings/pydrake/examples/BUILD.bazel, line 79 at r2 (raw file): Previously, EricCousineau-TRI wrote…
Done. bindings/pydrake/examples/test/pendulum_test.py, line 47 at r2 (raw file): Previously, EricCousineau-TRI wrote…
Done. Comments from Reviewable |
+@ggould-tri for platform review. Review status: 3 of 5 files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
; one state access style question below. Reviewed 3 of 5 files at r1, 2 of 2 files at r3. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file):
Given that people will frequently copy-paste from example code, is this the state access pattern we want to encourage? It seems like if more than one of your diagram's systems has state, this will be very obscure. Extracting the pendulum state in particular would be clearer, even if in this example it is unnecessary. Comments from Reviewable |
Completely agree. This was a function of the systems bindings that were in place so far. Cleanup is a priority for me and will come in follow-up PRs. (No way i want state access like this in my inline textbook examples :) Review status: all files reviewed at latest revision, 1 unresolved discussion. Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, ggould-tri wrote…
See comment above. Cleanup coming soon. Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, RussTedrake (Russ Tedrake) wrote…
Can you put in a TODO comment for now? If the cleanup gets missed or delayed, it would be good to have a breadcrumb. Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, ggould-tri wrote…
FYI. With MBT code we've been leaning towards an API provided by the system like the one here. So that reads Comments from Reviewable |
bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, amcastro-tri (Alejandro Castro) wrote…
If we connectivity information in each System locally, could we simplify this API further and have a system resolve it's context from any parent context (and avoid the need to call (I'm not sure what information is actually stored, but this is my impression when discussing Systems Python bindings, and how to handle stale pointers, which was part of the influence for using Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, EricCousineau-TRI wrote…
We intentionally restricted leaf systems to get only their own leaf contexts to provide a clear message and near-bulletproof guarantee that a leaf can access and modify only its own context. The intervention of a diagram is required to extract the appropriate leaf context from the diagram context. I still think that is a good idea, even if it requires some extra API calls. I think it aids clarity of code & thought. OTOH all those chained get_mutables are awful and unnecessary! Comments from Reviewable |
Review status: all files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, sherm1 (Michael Sherman) wrote…
Is there a way that an explicit API entrypoint could be introduced, something like For the chain of One minor note: Comments from Reviewable |
6f45d05
to
5f701b3
Compare
Review status: 4 of 5 files reviewed at latest revision, 1 unresolved discussion. bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, EricCousineau-TRI wrote…
great discussion. i've added the TODO. can i get an ok? :-) Comments from Reviewable |
bindings/pydrake/examples/test/pendulum_test.py, line 37 at r3 (raw file): Previously, RussTedrake (Russ Tedrake) wrote…
@amcastro-tri -- regarding your
@EricCousineau-TRI -- I'm torn about walking the line with Comments from Reviewable |
@RussTedrake. The reason I prefer the system level API is because by passing the context you have access to caching and also to parameters. The autgen vectors assume you can actually place this info in an array format. Consider the case in which the joint actually was model as a constraint for a "loop-joint". There is no angle in the state vector in that case but it is the result of a computation. Of course, in the general case we could copy the output (as we already do by the way) to a named vector with a set of useful numbers to the user, say joint angles. This is what I am doing for the energy shaping example. I'll send you a link when I push it so you can see it. |
This change is