コード例 #1
0
    def test_contact_visualizer(self, T):
        meshcat = Meshcat()
        params = ContactVisualizerParams()
        params.publish_period = 0.123
        params.default_color = Rgba(0.5, 0.5, 0.5)
        params.prefix = "py_visualizer"
        params.delete_on_initialization_event = False
        params.force_threshold = 0.2
        params.newtons_per_meter = 5
        params.radius = 0.1
        self.assertNotIn("object at 0x", repr(params))
        params2 = ContactVisualizerParams(publish_period=0.4)
        self.assertEqual(params2.publish_period, 0.4)
        vis = ContactVisualizer_[T](meshcat=meshcat, params=params)
        vis.Delete()
        vis.contact_results_input_port()

        builder = DiagramBuilder_[T]()
        plant, scene_graph = AddMultibodyPlantSceneGraph(builder, 0.01)
        plant.Finalize()
        ContactVisualizer_[T].AddToBuilder(builder=builder,
                                           plant=plant,
                                           meshcat=meshcat,
                                           params=params)
        ContactVisualizer_[T].AddToBuilder(
            builder=builder,
            contact_results_port=plant.get_contact_results_output_port(),
            meshcat=meshcat,
            params=params)
コード例 #2
0
ファイル: meldis.py プロジェクト: calderpg-tri/drake
    def __init__(self, *, meshcat):
        # By default, don't show any contact illustrations.
        meshcat.SetProperty("/CONTACT_RESULTS", "visible", False)

        # Add point visualization.
        params = ContactVisualizerParams()
        params.prefix = "/CONTACT_RESULTS/point"
        self._helper = _PointContactVisualizer(meshcat, params)
コード例 #3
0
 def test_internal_point_contact_visualizer(self):
     """A very basic existance test, since this class is internal use only.
     The pydrake-internal user (meldis) has additional acceptance tests.
     """
     meshcat = Meshcat()
     params = ContactVisualizerParams()
     dut = _PointContactVisualizer(meshcat=meshcat, params=params)