parameters: (args_parser, args)
return_statement: return update_visualization, connect_visualizers
docstring: Parses argparse arguments for visualizers, returning update_visualization
      and connect_visualizers.
docstring_summary: Parses argparse arguments for visualizers, returning update_visualization
      and connect_visualizers.
docstring_tokens: Parses argparse arguments for visualizers returning update_visualization and connect_visualizers .
function: def parse_visualizers(args_parser, args):
      """
      Parses argparse arguments for visualizers, returning update_visualization
      and connect_visualizers.
      """
  
      def update_visualization(plant, scene_graph):
          if args.visualize_collisions:
              # Find all the geometries that have not already been marked as
              # 'illustration' (visual) and assume they are collision geometries.
              # Then add illustration properties to them that will draw them in
              # red and fifty percent translucent.
              source_id = plant.get_source_id()
              inspector = scene_graph.model_inspector()
              diffuse_rgba = [1, 0, 0, 0.5]
              red_illustration = MakePhongIllustrationProperties(diffuse_rgba)
              for geometry_id in inspector.GetAllGeometryIds():
                  if inspector.GetIllustrationProperties(geometry_id) is None:
                      scene_graph.AssignRole(
                          source_id, geometry_id, red_illustration)
  
      def connect_visualizers(builder, plant, scene_graph):
          # Connect this to drake_visualizer.
          DrakeVisualizer.AddToBuilder(builder=builder, scene_graph=scene_graph)
  
          # Connect to Meshcat.
          if args.meshcat is not None:
              meshcat_viz = ConnectMeshcatVisualizer(
                  builder, scene_graph, zmq_url=args.meshcat,
                  role=args.meshcat_role,
                  prefer_hydro=args.meshcat_hydroelastic)
  
          # Connect to PyPlot.
          if args.pyplot:
              pyplot = ConnectPlanarSceneGraphVisualizer(builder, scene_graph)
  
      return update_visualization, connect_visualizers
function_tokens: def parse_visualizers ( args_parser , args ) : def update_visualization ( plant , scene_graph ) : if args . visualize_collisions : # Find all the geometries that have not already been marked as # 'illustration' (visual) and assume they are collision geometries. # Then add illustration properties to them that will draw them in # red and fifty percent translucent. source_id = plant . get_source_id ( ) inspector = scene_graph . model_inspector ( ) diffuse_rgba = [ 1 , 0 , 0 , 0.5 ] red_illustration = MakePhongIllustrationProperties ( diffuse_rgba ) for geometry_id in inspector . GetAllGeometryIds ( ) : if inspector . GetIllustrationProperties ( geometry_id ) is None : scene_graph . AssignRole ( source_id , geometry_id , red_illustration ) def connect_visualizers ( builder , plant , scene_graph ) : # Connect this to drake_visualizer. DrakeVisualizer . AddToBuilder ( builder = builder , scene_graph = scene_graph ) # Connect to Meshcat. if args . meshcat is not None : meshcat_viz = ConnectMeshcatVisualizer ( builder , scene_graph , zmq_url = args . meshcat , role = args . meshcat_role , prefer_hydro = args . meshcat_hydroelastic ) # Connect to PyPlot. if args . pyplot : pyplot = ConnectPlanarSceneGraphVisualizer ( builder , scene_graph ) return update_visualization , connect_visualizers