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 geometry: Expose RenderEngine API and trampoline for inheritance #13835
py geometry: Expose RenderEngine API and trampoline for inheritance #13835
Conversation
@thduynguyen Handing off to you for completion. Feel free to push here and/or start a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+@thduynguyen for finishing up
Reviewable status: LGTM missing from assignee thduynguyen, needs platform reviewer assigned, needs at least two assigned reviewers, commits need curation (https://drake.mit.edu/reviewable.html#curated-commits) (waiting on @thduynguyen)
See PR: EricCousineau-TRI#13 |
Tagging @takuya-ikeda-tri |
@thduynguyen Does this happen to have your latest changes? (I just merged your PR in) |
From Duy: |
fe08ebf
to
d05a866
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+@thduynguyen for feature review, please
+@SeanCurtis-TRI for platform review, please
Reviewable status: LGTM missing from assignees SeanCurtis-TRI(platform),thduynguyen (waiting on @SeanCurtis-TRI and @thduynguyen)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1.
Reviewable status: 4 unresolved discussions, LGTM missing from assignee SeanCurtis-TRI(platform) (waiting on @EricCousineau-TRI, @SeanCurtis-TRI, and @thduynguyen)
bindings/pydrake/test/geometry_test.py, line 18 at r1 (raw file):
from pydrake.common.value import AbstractValue, Value from pydrake.lcm import DrakeLcm, Subscriber from pydrake.math import RigidTransform, RigidTransform_
BTW, what's the difference between RigidTransform
and RigidTransform_
? There are many re-definitions of RigidTransform = RigidTransform_[float]
below in this file and that causes confusion. Can you either remove this or change the aliases to RigidTransformf
?
bindings/pydrake/test/geometry_test.py, line 636 at r1 (raw file):
Value[mut.render.RenderLabel] def test_render_camera_api(self):
BTW, are these 2 lines needed?
bindings/pydrake/test/geometry_test.py, line 643 at r1 (raw file):
"""Mirror of C++ DummyRenderEngine.""" latest_intance = None
nit, variable name typo: latest_instance
bindings/pydrake/test/geometry_test.py, line 643 at r1 (raw file):
"""Mirror of C++ DummyRenderEngine.""" latest_intance = None
nit, can you add a comment here stating this's only needed for testing (and why)?
bindings/pydrake/test/geometry_test.py, line 682 at r1 (raw file):
def ImplementGeometry(self, shape, user_data): DummyRenderEngine.latest_instance = self pass
nit, redundant pass
.
bindings/pydrake/test/geometry_test.py, line 703 at r1 (raw file):
def DoClone(self): DummyRenderEngine.latest_instance = self
nit, shouldn't latest_instance = new
in this case?
d05a866
to
0496e02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: LGTM missing from assignee SeanCurtis-TRI(platform) (waiting on @SeanCurtis-TRI and @thduynguyen)
bindings/pydrake/test/geometry_test.py, line 18 at r1 (raw file):
Previously, thduynguyen (Duy-Nguyen Ta) wrote…
BTW, what's the difference between
RigidTransform
andRigidTransform_
? There are many re-definitions ofRigidTransform = RigidTransform_[float]
below in this file and that causes confusion. Can you either remove this or change the aliases toRigidTransformf
?
OK I'd like to keep it as-is for now. See here:
https://drake.mit.edu/python_bindings.html#differences-with-c-api
(Could consider as a separate PR focused on that, but I wanna punt for now ;)
bindings/pydrake/test/geometry_test.py, line 636 at r1 (raw file):
Previously, thduynguyen (Duy-Nguyen Ta) wrote…
BTW, are these 2 lines needed?
Done. Oops!
bindings/pydrake/test/geometry_test.py, line 643 at r1 (raw file):
Previously, thduynguyen (Duy-Nguyen Ta) wrote…
nit, variable name typo:
latest_instance
Done. Oops as well!
bindings/pydrake/test/geometry_test.py, line 643 at r1 (raw file):
Previously, thduynguyen (Duy-Nguyen Ta) wrote…
nit, can you add a comment here stating this's only needed for testing (and why)?
Done.
bindings/pydrake/test/geometry_test.py, line 682 at r1 (raw file):
Previously, thduynguyen (Duy-Nguyen Ta) wrote…
nit, redundant
pass
.
Done.
bindings/pydrake/test/geometry_test.py, line 703 at r1 (raw file):
Previously, thduynguyen (Duy-Nguyen Ta) wrote…
nit, shouldn't
latest_instance = new
in this case?
OK Nah, that smells a tad odd. I can explain more if you like.
0496e02
to
c2eea45
Compare
c2eea45
to
030fcd0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-@SeanCurtis-TRI +@sammy-tri for platform, please!
Reviewable status: LGTM missing from assignee sammy-tri(platform) (waiting on @sammy-tri and @thduynguyen)
030fcd0
to
88c334b
Compare
Removed excess bindings / PTAL! |
Er... On second though, mayhaps I should keep the pure virtual NVI methods? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r1, 1 of 1 files at r2, 1 of 1 files at r3.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform) (waiting on @EricCousineau-TRI)
bindings/pydrake/geometry_py.cc, line 316 at r3 (raw file):
&Class::default_render_label), cls_doc.default_render_label.doc) .def("GetRenderLabelOrThrow",
is it worth adding a comment explaining that we're deliberately binding to the trampoline even though https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python says not to? (I assume it's something to do with moving these functions into the public
section).
Co-Authored-By: Duy-Nguyen Ta <duynguyen.ta@tri.global>
88c334b
to
078ad14
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per Slack, will keep the pure virtual NVI methods out for now. Yes, there may be a lack of docs; we can always come back and cherry-pick from r2
if need be.
Reviewable status: 1 unresolved discussion, LGTM missing from assignee sammy-tri(platform) (waiting on @sammy-tri)
bindings/pydrake/geometry_py.cc, line 316 at r3 (raw file):
Previously, sammy-tri (Sam Creasey) wrote…
is it worth adding a comment explaining that we're deliberately binding to the trampoline even though https://pybind11.readthedocs.io/en/stable/advanced/classes.html#overriding-virtual-functions-in-python says not to? (I assume it's something to do with moving these functions into the
public
section).
Done. Thanks!
There was a problem hiding this 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 r4.
Reviewable status: complete! all discussions resolved, LGTM from assignees sammy-tri(platform),thduynguyen
Skipping slow build |
@thduynguyen @EricCousineau-TRI In looking at the bindings in Given it's only been 16 days since the merge, do you think we can get away with this (without deprecation, that is)? |
Yeah, I'd be fine with that! |
Resolves #13834
FYI @thduynguyen and @SeanCurtis-TRI Review will be coming y'all's way once this is ready ;)
This change is