117 lines
3.9 KiB
Python
117 lines
3.9 KiB
Python
|
import os
|
||
|
from launch import LaunchDescription, LaunchContext
|
||
|
from launch.actions import (
|
||
|
DeclareLaunchArgument,
|
||
|
IncludeLaunchDescription,
|
||
|
ExecuteProcess,
|
||
|
OpaqueFunction
|
||
|
)
|
||
|
from ament_index_python.packages import get_package_share_directory
|
||
|
from launch.conditions import IfCondition, UnlessCondition
|
||
|
from launch.launch_description_sources import PythonLaunchDescriptionSource
|
||
|
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
|
||
|
from launch_ros.actions import Node
|
||
|
from launch_ros.substitutions import FindPackageShare
|
||
|
from rbs_launch_utils.launch_common import load_yaml
|
||
|
|
||
|
|
||
|
def generate_launch_description():
|
||
|
|
||
|
declared_arguments = []
|
||
|
|
||
|
declared_arguments.append(
|
||
|
DeclareLaunchArgument(
|
||
|
"robot_description",
|
||
|
default_value="",
|
||
|
description="robot description string",
|
||
|
)
|
||
|
)
|
||
|
declared_arguments.append(
|
||
|
DeclareLaunchArgument("robot_description_semantic", default_value="")
|
||
|
)
|
||
|
declared_arguments.append(
|
||
|
DeclareLaunchArgument("robot_description_kinematics", default_value="")
|
||
|
)
|
||
|
declared_arguments.append(
|
||
|
DeclareLaunchArgument("use_sim_time", default_value="")
|
||
|
)
|
||
|
declared_arguments.append(
|
||
|
DeclareLaunchArgument("with_gripper_condition", default_value="")
|
||
|
)
|
||
|
declared_arguments.append(
|
||
|
DeclareLaunchArgument("points_params_filepath", default_value="")
|
||
|
)
|
||
|
|
||
|
robot_description_decl = LaunchConfiguration("robot_description")
|
||
|
robot_description_semantic_decl = LaunchConfiguration("robot_description_semantic")
|
||
|
robot_description_kinematics = LaunchConfiguration("robot_description_kinematics")
|
||
|
use_sim_time = LaunchConfiguration("use_sim_time")
|
||
|
with_gripper_condition = LaunchConfiguration("with_gripper_condition")
|
||
|
points_params_filepath_decl = LaunchConfiguration("points_params_filepath")
|
||
|
robot_description = {"robot_description": robot_description_decl}
|
||
|
robot_description_semantic = {"robot_description_semantic": robot_description_semantic_decl}
|
||
|
|
||
|
points_params = load_yaml(
|
||
|
"rbs_skill_servers", "config/gripperPositions.yaml"
|
||
|
)
|
||
|
|
||
|
move_topose_action_server = Node(
|
||
|
package="rbs_skill_servers",
|
||
|
executable="move_topose_action_server",
|
||
|
parameters=[
|
||
|
robot_description,
|
||
|
robot_description_semantic,
|
||
|
robot_description_kinematics,
|
||
|
{"use_sim_time": use_sim_time},
|
||
|
]
|
||
|
)
|
||
|
|
||
|
gripper_control_node = Node(
|
||
|
package="rbs_skill_servers",
|
||
|
executable="gripper_control_action_server",
|
||
|
parameters= [
|
||
|
robot_description,
|
||
|
robot_description_semantic,
|
||
|
robot_description_kinematics,
|
||
|
{"use_sim_time": use_sim_time},
|
||
|
],
|
||
|
condition=IfCondition(with_gripper_condition)
|
||
|
)
|
||
|
|
||
|
move_cartesian_path_action_server = Node(
|
||
|
package="rbs_skill_servers",
|
||
|
executable="move_cartesian_path_action_server",
|
||
|
parameters=[
|
||
|
robot_description,
|
||
|
robot_description_semantic,
|
||
|
robot_description_kinematics,
|
||
|
{"use_sim_time": use_sim_time},
|
||
|
]
|
||
|
)
|
||
|
|
||
|
move_joint_state_action_server = Node(
|
||
|
package="rbs_skill_servers",
|
||
|
executable="move_to_joint_states_action_server",
|
||
|
parameters=[
|
||
|
robot_description,
|
||
|
robot_description_semantic,
|
||
|
robot_description_kinematics,
|
||
|
{"use_sim_time": use_sim_time},
|
||
|
]
|
||
|
)
|
||
|
|
||
|
grasp_pose_loader = Node(
|
||
|
package="rbs_skill_servers",
|
||
|
executable="pick_place_pose_loader_service_server",
|
||
|
output="screen"
|
||
|
)
|
||
|
|
||
|
nodes_to_start =[
|
||
|
move_topose_action_server,
|
||
|
gripper_control_node,
|
||
|
move_cartesian_path_action_server,
|
||
|
move_joint_state_action_server,
|
||
|
grasp_pose_loader
|
||
|
]
|
||
|
|
||
|
return LaunchDescription(declared_arguments + nodes_to_start)
|