Skip to content

Commit

Permalink
Revert "[pybind] Moves a historically flaky RenderEngine test into it…
Browse files Browse the repository at this point in the history
…s own test (RobotLocomotion#14724)"

This reverts commit 5a7203e.
  • Loading branch information
SeanCurtis-TRI authored and EricCousineau-TRI committed Mar 8, 2021
1 parent 060ffda commit bd40ce2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 98 deletions.
10 changes: 0 additions & 10 deletions bindings/pydrake/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -481,16 +481,6 @@ drake_py_unittest(
],
)

drake_py_unittest(
name = "geometry_render_engine_subclass_test",
flaky = True,
deps = [
":geometry_py",
"//bindings/pydrake/common/test_utilities",
"//bindings/pydrake/systems:sensors_py",
],
)

drake_py_unittest(
name = "lcm_test",
deps = [
Expand Down
88 changes: 0 additions & 88 deletions bindings/pydrake/test/geometry_render_engine_subclass_test.py

This file was deleted.

65 changes: 65 additions & 0 deletions bindings/pydrake/test/geometry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,71 @@ def test_value_instantiations(self, T):
Value[mut.Rgba]
Value[mut.render.RenderLabel]

def test_unimplemented_rendering(self):
# Test that a derived RenderEngine has implementations of
# DoRender*Image that throw something suggestive of "not implemented"
# and that they are overridable.
class MinimalEngine(mut.render.RenderEngine):
def UpdateViewpoint(self, X_WC):
pass

def DoRegisterVisual(self, id, shae, properties, X_WG):
pass

def DoUpdateVisualPose(self, id, X_WG):
pass

def DoRemoveGeometry(self, id):
pass

def DoClone(self):
pass

class ColorOnlyEngine(MinimalEngine):
def DoRenderColorImage(self, camera, image_out):
pass

class DepthOnlyEngine(MinimalEngine):
def DoRenderDepthImage(self, camera, image_out):
pass

class LabelOnlyEngine(MinimalEngine):
def DoRenderLabelImage(self, camera, image_out):
pass

identity = RigidTransform_[float]()
intrinsics = CameraInfo(10, 10, np.pi / 4)
core = mut.render.RenderCameraCore("n/a", intrinsics,
mut.render.ClippingRange(0.1, 10),
identity)
color_cam = mut.render.ColorRenderCamera(core, False)
depth_cam = mut.render.DepthRenderCamera(
core, mut.render.DepthRange(0.1, 9))
color_image = ImageRgba8U(intrinsics.width(), intrinsics.height())
depth_image = ImageDepth32F(intrinsics.width(), intrinsics.height())
label_image = ImageLabel16I(intrinsics.width(), intrinsics.height())

color_only = ColorOnlyEngine()
color_only.RenderColorImage(color_cam, color_image)
with self.assertRaisesRegex(RuntimeError, ".+pure virtual function.+"):
color_only.RenderDepthImage(depth_cam, depth_image)
with self.assertRaisesRegex(RuntimeError, ".+pure virtual function.+"):
color_only.RenderLabelImage(color_cam, label_image)

depth_only = DepthOnlyEngine()
with self.assertRaisesRegex(RuntimeError, ".+pure virtual function.+"):
depth_only.RenderColorImage(color_cam, color_image)
depth_only.RenderDepthImage(depth_cam, depth_image)
with self.assertRaisesRegex(RuntimeError, ".+pure virtual function.+"):
depth_only.RenderLabelImage(color_cam, label_image)

label_only = LabelOnlyEngine()
with self.assertRaisesRegex(RuntimeError, ".+pure virtual function.+"):
label_only.RenderColorImage(color_cam, color_image)
with self.assertRaisesRegex(RuntimeError, ".+pure virtual function.+"):
label_only.RenderDepthImage(depth_cam, depth_image)
label_only.RenderLabelImage(color_cam, label_image)

def test_render_engine_api(self):
class DummyRenderEngine(mut.render.RenderEngine):
"""Mirror of C++ DummyRenderEngine."""
Expand Down

0 comments on commit bd40ce2

Please sign in to comment.