82 lines
3.8 KiB
Python
82 lines
3.8 KiB
Python
#!/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, DeclareLaunchArgument
|
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
|
from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir, PathJoinSubstitution
|
|
from launch_ros.actions import Node
|
|
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)
|
|
dof = LaunchConfiguration('dof', default=7)
|
|
robot_type = LaunchConfiguration('robot_type', default='xarm')
|
|
|
|
add_realsense_d435i = LaunchConfiguration('add_realsense_d435i', 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"')
|
|
|
|
# robot joint state launch
|
|
# xarm_description/launch/_robot_joint_state.launch.py
|
|
robot_joint_state_launch = IncludeLaunchDescription(
|
|
PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/_robot_joint_state.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': dof,
|
|
'robot_type': robot_type,
|
|
'add_realsense_d435i': add_realsense_d435i,
|
|
'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(),
|
|
)
|
|
|
|
# rviz2 display launch
|
|
# xarm_description/launch/_rviz_display.launch.py
|
|
rviz2_launch = IncludeLaunchDescription(
|
|
PythonLaunchDescriptionSource([ThisLaunchFileDir(), '/_rviz_display.launch.py']),
|
|
)
|
|
|
|
return LaunchDescription([
|
|
robot_joint_state_launch,
|
|
rviz2_launch
|
|
])
|