From c65d58dec806712c4fd53044be9d7209a3df4fe4 Mon Sep 17 00:00:00 2001 From: Rick Poyner Date: Fri, 8 Nov 2024 17:59:31 -0500 Subject: [PATCH] wip: these are why we need to gc-ify DrakeLcmInterface --- bindings/pydrake/geometry/test/visualizers_test.py | 1 + bindings/pydrake/lcm_py.cc | 2 +- bindings/pydrake/multibody/test/plant_test.py | 1 + bindings/pydrake/systems/test/sensors_test.py | 1 + bindings/pydrake/visualization/test/meldis_test.py | 5 +++++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bindings/pydrake/geometry/test/visualizers_test.py b/bindings/pydrake/geometry/test/visualizers_test.py index 77cc445ba0d5..8cae33eff20b 100644 --- a/bindings/pydrake/geometry/test/visualizers_test.py +++ b/bindings/pydrake/geometry/test/visualizers_test.py @@ -56,6 +56,7 @@ def by_hand(builder, scene_graph, params): visualizer.query_object_input_port()) def auto_connect_to_system(builder, scene_graph, params): + # XXX lcm annotations?? mut.DrakeVisualizer_[T].AddToBuilder(builder=builder, scene_graph=scene_graph, lcm=lcm, params=params) diff --git a/bindings/pydrake/lcm_py.cc b/bindings/pydrake/lcm_py.cc index 7fb7bd6df591..5d3973891638 100644 --- a/bindings/pydrake/lcm_py.cc +++ b/bindings/pydrake/lcm_py.cc @@ -26,7 +26,7 @@ PYBIND11_MODULE(lcm, m) { { using Class = DrakeLcmInterface; constexpr auto& cls_doc = doc.DrakeLcmInterface; - py::class_(m, "DrakeLcmInterface", py::dynamic_attr(), cls_doc.doc) + py::class_(m, "DrakeLcmInterface", cls_doc.doc) .def("get_lcm_url", &DrakeLcmInterface::get_lcm_url, cls_doc.get_lcm_url.doc) .def( diff --git a/bindings/pydrake/multibody/test/plant_test.py b/bindings/pydrake/multibody/test/plant_test.py index d3dd9a0faaef..221a47e05eda 100644 --- a/bindings/pydrake/multibody/test/plant_test.py +++ b/bindings/pydrake/multibody/test/plant_test.py @@ -3095,6 +3095,7 @@ def test_connect_contact_results(self): [{}, {"publish_period": None}, {"publish_period": 1.0/32}]): kwargs = collections.ChainMap(*optional_args) with self.subTest(num_optional_args=len(kwargs), **kwargs): + # XXX lcm annotations?? publisher = ConnectContactResultsToDrakeVisualizer( builder=builder, plant=plant, scene_graph=scene_graph, **kwargs) diff --git a/bindings/pydrake/systems/test/sensors_test.py b/bindings/pydrake/systems/test/sensors_test.py index 07d376ef995b..64ef158199f7 100644 --- a/bindings/pydrake/systems/test/sensors_test.py +++ b/bindings/pydrake/systems/test/sensors_test.py @@ -246,6 +246,7 @@ def test_camera_config(self): plant, scene_graph = AddMultibodyPlantSceneGraph(builder, 0.0) system_count = len(builder.GetSystems()) lcm = DrakeLcm() + # XXX lcm annotations?? mut.ApplyCameraConfig(config=config, plant=plant, builder=builder, scene_graph=scene_graph, lcm=lcm) # Systems have been added. diff --git a/bindings/pydrake/visualization/test/meldis_test.py b/bindings/pydrake/visualization/test/meldis_test.py index eb7500593abc..0c0c9326f607 100644 --- a/bindings/pydrake/visualization/test/meldis_test.py +++ b/bindings/pydrake/visualization/test/meldis_test.py @@ -95,6 +95,7 @@ def _make_diagram(self, *, resource, visualizer_params, lcm): parser = Parser(plant=plant) parser.AddModels(url=f"package://{resource}") plant.Finalize() + # XXX lcm annotations?? DrakeVisualizer.AddToBuilder(builder=builder, scene_graph=scene_graph, params=visualizer_params, lcm=lcm) diagram = builder.Build() @@ -458,6 +459,7 @@ def test_viewer_applet_alpha_slider(self): """, "sdf") plant.Finalize() + # XXX lcm annotations?? DrakeVisualizer.AddToBuilder(builder=builder, scene_graph=scene_graph, params=DrakeVisualizerParams(), lcm=lcm) diagram = builder.Build() @@ -516,6 +518,7 @@ def test_viewer_applet_in_memory_mesh(self): scene_graph.AssignRole(plant.get_source_id(), g_id, IllustrationProperties()) lcm = dut._lcm + # XXX lcm annotations?? DrakeVisualizer.AddToBuilder(builder=builder, scene_graph=scene_graph, params=DrakeVisualizerParams(), lcm=lcm) plant.Finalize() @@ -589,6 +592,7 @@ def test_contact_applet_point_pair(self): name="sphere2_x", frame_on_parent=plant.world_body().body_frame(), frame_on_child=body2.body_frame(), axis=[1, 0, 0])) plant.Finalize() + # XXX lcm annotations?? ConnectContactResultsToDrakeVisualizer( builder=builder, plant=plant, scene_graph=scene_graph, lcm=lcm) diagram = builder.Build() @@ -632,6 +636,7 @@ def test_contact_applet_hydroelastic(self): name="body2", frame_on_parent=plant.world_body().body_frame(), frame_on_child=body2.body_frame(), axis=[1, 0, 0])) plant.Finalize() + # XXX lcm annotations?? ConnectContactResultsToDrakeVisualizer( builder=builder, plant=plant, scene_graph=scene_graph, lcm=lcm) diagram = builder.Build()