runtime/rbs_bt_executor/launch/rbs_executor.launch.py

67 lines
2.3 KiB
Python
Raw Normal View History

2023-02-03 07:04:12 +00:00
from launch import LaunchDescription
2023-12-29 22:55:27 +03:00
from launch.actions import DeclareLaunchArgument
2023-02-03 07:04:12 +00:00
from launch_ros.actions import Node
from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution
from launch_ros.substitutions import FindPackageShare
2023-12-29 22:55:27 +03:00
# from ament_index_python.packages import get_package_share_directory
# import os
2023-02-03 07:04:12 +00:00
2023-11-16 13:15:27 +03:00
def generate_launch_description():
2023-11-14 13:04:11 +03:00
2023-12-29 22:55:27 +03:00
declared_arguments = []
declared_arguments.append(
DeclareLaunchArgument(
"bt_file",
default_value="test_tree_env_manager.xml",
description="BehaviorTree file for run.",
)
)
bt_file = LaunchConfiguration("bt_file")
2023-11-16 13:15:27 +03:00
robot_description_semantic_content = Command(
[
PathJoinSubstitution([FindExecutable(name="xacro")]),
" ",
PathJoinSubstitution(
[FindPackageShare("ur_moveit_config"), "srdf", "ur.srdf.xacro"]
),
" ",
"name:=",
"ur",
" ",
"prefix:=",
"",
" ",
]
)
robot_description_semantic = {"robot_description_semantic": robot_description_semantic_content}
2023-11-14 13:04:11 +03:00
2023-12-29 22:55:27 +03:00
btfile_description = PathJoinSubstitution(
[FindPackageShare("rbs_bt_executor"), "bt_trees", bt_file]
)
btfile_param = {"bt_file_path": btfile_description}
nodes_to_start = [
2023-02-03 07:04:12 +00:00
Node(
package='behavior_tree',
executable='bt_engine',
2023-11-16 13:15:27 +03:00
#prefix=['xterm -e gdb -ex run --args'],
2023-02-03 07:04:12 +00:00
parameters=[
2023-12-29 22:55:27 +03:00
btfile_param,
#{'bt_file_path': os.path.join(get_package_share_directory('rbs_bt_executor'), 'bt_trees/' + bt_file)},
2023-11-16 13:15:27 +03:00
{'plugins':["rbs_skill_move_topose_bt_action_client",
"rbs_skill_get_pick_place_pose_service_client",
"rbs_skill_gripper_move_bt_action_client",
"rbs_skill_move_joint_state",
"rbs_add_planning_scene_object",
"rbs_pose_estimation",
"rbs_env_manager_starter"
2023-11-16 13:15:27 +03:00
]},
# gripperPoints,
2023-11-16 13:15:27 +03:00
robot_description_semantic
2023-02-03 07:04:12 +00:00
]
)
2023-12-29 22:55:27 +03:00
]
return LaunchDescription(declared_arguments + nodes_to_start)