Пример #1
0
 def test_scene_graph_api(self):
     scene_graph = mut.SceneGraph()
     global_source = scene_graph.RegisterSource("anchored")
     self.assertIsInstance(
         scene_graph.get_source_pose_port(global_source), InputPort)
     self.assertIsInstance(
         scene_graph.get_pose_bundle_output_port(), OutputPort)
     self.assertIsInstance(
         scene_graph.get_query_output_port(), OutputPort)
     # Test visualization API.
     # Use a mockable so that we can make a smoke test without side effects.
     lcm = DrakeMockLcm()
     for i in range(2):
         builder = DiagramBuilder()
         scene_graph = builder.AddSystem(mut.SceneGraph())
         if i == 1:
             mut.ConnectDrakeVisualizer(
                 builder=builder, scene_graph=scene_graph)
         else:
             mut.ConnectDrakeVisualizer(
                 builder=builder, scene_graph=scene_graph,
                 pose_bundle_output_port=(
                     scene_graph.get_pose_bundle_output_port()))
         mut.DispatchLoadMessage(
             scene_graph=scene_graph, lcm=lcm)
Пример #2
0
    def test_connect_drake_visualizer(self):
        # Test visualization API.
        # Use a mockable so that we can make a smoke test without side
        # effects.
        T = float
        SceneGraph = mut.SceneGraph_[T]
        DiagramBuilder = DiagramBuilder_[T]
        lcm = DrakeMockLcm()

        for role in [mut.Role.kProximity, mut.Role.kIllustration]:
            for i in range(2):
                builder = DiagramBuilder()
                scene_graph = builder.AddSystem(SceneGraph())
                if i == 1:
                    mut.ConnectDrakeVisualizer(builder=builder,
                                               scene_graph=scene_graph,
                                               lcm=lcm,
                                               role=role)
                else:
                    mut.ConnectDrakeVisualizer(
                        builder=builder,
                        scene_graph=scene_graph,
                        pose_bundle_output_port=(
                            scene_graph.get_pose_bundle_output_port()),
                        lcm=lcm,
                        role=role)
                mut.DispatchLoadMessage(scene_graph=scene_graph,
                                        lcm=lcm,
                                        role=role)
Пример #3
0
 def normal(builder, scene_graph):
     with catch_drake_warnings(expected_count=2):
         mut.ConnectDrakeVisualizer(
             builder=builder, scene_graph=scene_graph,
             lcm=lcm, role=role)
         mut.DispatchLoadMessage(
             scene_graph=scene_graph, lcm=lcm, role=role)
Пример #4
0
 def normal(builder, scene_graph):
     mut.ConnectDrakeVisualizer(builder=builder,
                                scene_graph=scene_graph,
                                lcm=lcm,
                                role=role)
     mut.DispatchLoadMessage(scene_graph=scene_graph,
                             lcm=lcm,
                             role=role)
Пример #5
0
 def port(builder, scene_graph):
     mut.ConnectDrakeVisualizer(
         builder=builder, scene_graph=scene_graph,
         pose_bundle_output_port=(
             scene_graph.get_pose_bundle_output_port()),
         lcm=lcm, role=role)
     mut.DispatchLoadMessage(
         scene_graph=scene_graph, lcm=lcm, role=role)
Пример #6
0
 def port(builder, scene_graph):
     with catch_drake_warnings(expected_count=2):
         mut.ConnectDrakeVisualizer(
             builder=builder, scene_graph=scene_graph,
             pose_bundle_output_port=(
                 scene_graph.get_pose_bundle_output_port()),
             lcm=lcm, role=role)
         mut.DispatchLoadMessage(
             scene_graph=scene_graph, lcm=lcm, role=role)