text: #!/usr/bin/env python3
  # Software License Agreement (BSD License)
  #
  # Copyright (c) 2021, UFACTORY, Inc.
  # All rights reserved.
  #
  # Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
  
  from launch import LaunchDescription
  from launch.actions import IncludeLaunchDescription
  from launch.launch_description_sources import PythonLaunchDescriptionSource
  from launch.substitutions import LaunchConfiguration, PathJoinSubstitution
  from launch_ros.substitutions import FindPackageShare
  
  
  def generate_launch_description():
      prefix = LaunchConfiguration('prefix', default='')
      hw_ns = LaunchConfiguration('hw_ns', default='xarm')
      limited = LaunchConfiguration('limited', default=False)
      effort_control = LaunchConfiguration('effort_control', default=False)
      velocity_control = LaunchConfiguration('velocity_control', default=False)
      add_gripper = LaunchConfiguration('add_gripper', default=False)
      add_vacuum_gripper = LaunchConfiguration('add_vacuum_gripper', default=False)
  
      add_other_geometry = LaunchConfiguration('add_other_geometry', default=False)
      geometry_type = LaunchConfiguration('geometry_type', default='box')
      geometry_mass = LaunchConfiguration('geometry_mass', default=0.1)
      geometry_height = LaunchConfiguration('geometry_height', default=0.1)
      geometry_radius = LaunchConfiguration('geometry_radius', default=0.1)
      geometry_length = LaunchConfiguration('geometry_length', default=0.1)
      geometry_width = LaunchConfiguration('geometry_width', default=0.1)
      geometry_mesh_filename = LaunchConfiguration('geometry_mesh_filename', default='')
      geometry_mesh_origin_xyz = LaunchConfiguration('geometry_mesh_origin_xyz', default='"0 0 0"')
      geometry_mesh_origin_rpy = LaunchConfiguration('geometry_mesh_origin_rpy', default='"0 0 0"')
      geometry_mesh_tcp_xyz = LaunchConfiguration('geometry_mesh_tcp_xyz', default='"0 0 0"')
      geometry_mesh_tcp_rpy = LaunchConfiguration('geometry_mesh_tcp_rpy', default='"0 0 0"')
  
      dof = 6
  
      # xarm moveit fake launch
      # xarm_moveit_config/launch/_xarm_moveit_fake.launch.py
      xarm_moveit_fake_launch = IncludeLaunchDescription(
          PythonLaunchDescriptionSource(PathJoinSubstitution([FindPackageShare('xarm_moveit_config'), 'launch', '_xarm_moveit_fake.launch.py'])),
          launch_arguments={
              'prefix': prefix,
              'hw_ns': hw_ns,
              'limited': limited,
              'effort_control': effort_control,
              'velocity_control': velocity_control,
              'add_gripper': add_gripper,
              'add_vacuum_gripper': add_vacuum_gripper,
              'dof': str(dof),
              'no_gui_ctrl': 'true',
              'add_other_geometry': add_other_geometry,
              'geometry_type': geometry_type,
              'geometry_mass': geometry_mass,
              'geometry_height': geometry_height,
              'geometry_radius': geometry_radius,
              'geometry_length': geometry_length,
              'geometry_width': geometry_width,
              'geometry_mesh_filename': geometry_mesh_filename,
              'geometry_mesh_origin_xyz': geometry_mesh_origin_xyz,
              'geometry_mesh_origin_rpy': geometry_mesh_origin_rpy,
              'geometry_mesh_tcp_xyz': geometry_mesh_tcp_xyz,
              'geometry_mesh_tcp_rpy': geometry_mesh_tcp_rpy,
          }.items(),
      )
  
      # xarm planner launch
      # xarm_planner/launch/_xarm_planner.launch.py
      xarm_planner_node_launch = IncludeLaunchDescription(
          PythonLaunchDescriptionSource(PathJoinSubstitution([FindPackageShare('xarm_planner'), 'launch', '_xarm_planner.launch.py'])),
          launch_arguments={
              'prefix': prefix,
              'hw_ns': hw_ns,
              'limited': limited,
              'effort_control': effort_control,
              'velocity_control': velocity_control,
              'add_gripper': add_gripper,
              'add_vacuum_gripper': add_vacuum_gripper,
              'dof': str(dof),
              'ros2_control_plugin': 'xarm_control/FakeXArmHW',
              'add_other_geometry': add_other_geometry,
              'geometry_type': geometry_type,
              'geometry_mass': geometry_mass,
              'geometry_height': geometry_height,
              'geometry_radius': geometry_radius,
              'geometry_length': geometry_length,
              'geometry_width': geometry_width,
              'geometry_mesh_filename': geometry_mesh_filename,
              'geometry_mesh_origin_xyz': geometry_mesh_origin_xyz,
              'geometry_mesh_origin_rpy': geometry_mesh_origin_rpy,
              'geometry_mesh_tcp_xyz': geometry_mesh_tcp_xyz,
              'geometry_mesh_tcp_rpy': geometry_mesh_tcp_rpy,
          }.items(),
      )
      
      return LaunchDescription([
          xarm_moveit_fake_launch,
          xarm_planner_node_launch
      ])
  