6 from ament_index_python.packages
import get_package_share_directory
7 from launch.actions
import ExecuteProcess
8 from launch_ros.actions
import Node
9 from launch_ros.descriptions
import ComposableNode
10 from launch_ros.actions
import ComposableNodeContainer
15 absolute_file_path = os.path.join(package_path, file_path)
18 with open(absolute_file_path,
"r")
as file:
20 except EnvironmentError:
26 absolute_file_path = os.path.join(package_path, file_path)
29 with open(absolute_file_path,
"r")
as file:
30 return yaml.safe_load(file)
31 except EnvironmentError:
36 robot_description_config = xacro.process_file(
43 robot_description = {
"robot_description": robot_description_config.toxml()}
44 return robot_description
48 robot_description_semantic_config =
load_file(
49 "moveit_resources_panda_moveit_config",
"config/panda.srdf"
51 robot_description_semantic = {
52 "robot_description_semantic": robot_description_semantic_config
54 return robot_description_semantic
63 "moveit_resources_panda_moveit_config",
"config/kinematics.yaml"
67 planning_pipelines_config = {
69 "planning_plugin":
"ompl_interface/OMPLPlanner",
70 "request_adapters":
"""default_planner_request_adapters/AddTimeOptimalParameterization default_planner_request_adapters/FixWorkspaceBounds default_planner_request_adapters/FixStartStateBounds default_planner_request_adapters/FixStartStateCollision default_planner_request_adapters/FixStartStatePathConstraints""",
71 "start_state_max_bounds_error": 0.1,
75 "moveit_resources_panda_moveit_config",
"config/ompl_planning.yaml"
77 planning_pipelines_config[
"ompl"].update(ompl_planning_yaml)
79 moveit_simple_controllers_yaml =
load_yaml(
80 "moveit_resources_panda_moveit_config",
"config/moveit_controllers.yaml"
82 moveit_controllers = {
83 "moveit_simple_controller_manager": moveit_simple_controllers_yaml,
84 "moveit_controller_manager":
"moveit_simple_controller_manager/MoveItSimpleControllerManager",
89 "moveit_hybrid_planning",
"config/common_hybrid_planning_params.yaml"
92 "moveit_hybrid_planning",
"config/global_planner.yaml"
95 "moveit_hybrid_planning",
"config/local_planner.yaml"
97 hybrid_planning_manager_param =
load_yaml(
98 "moveit_hybrid_planning",
"config/hybrid_planning_manager.yaml"
102 container = ComposableNodeContainer(
103 name=
"hybrid_planning_container",
105 package=
"rclcpp_components",
106 executable=
"component_container_mt",
107 composable_node_descriptions=[
109 package=
"moveit_hybrid_planning",
110 plugin=
"moveit::hybrid_planning::GlobalPlannerComponent",
111 name=
"global_planner",
113 common_hybrid_planning_param,
114 global_planner_param,
116 robot_description_semantic,
118 planning_pipelines_config,
123 package=
"moveit_hybrid_planning",
124 plugin=
"moveit::hybrid_planning::LocalPlannerComponent",
125 name=
"local_planner",
127 common_hybrid_planning_param,
130 robot_description_semantic,
135 package=
"moveit_hybrid_planning",
136 plugin=
"moveit::hybrid_planning::HybridPlanningManager",
137 name=
"hybrid_planning_manager",
139 common_hybrid_planning_param,
140 hybrid_planning_manager_param,
150 +
"/config/hybrid_planning_demo.rviz"
157 arguments=[
"-d", rviz_config_file],
158 parameters=[robot_description, robot_description_semantic],
164 executable=
"static_transform_publisher",
165 name=
"static_transform_publisher",
167 arguments=[
"0.0",
"0.0",
"0.0",
"0.0",
"0.0",
"0.0",
"world",
"panda_link0"],
171 robot_state_publisher = Node(
172 package=
"robot_state_publisher",
173 executable=
"robot_state_publisher",
174 name=
"robot_state_publisher",
176 parameters=[robot_description],
180 ros2_controllers_path = os.path.join(
183 "demo_controller.yaml",
185 ros2_control_node = Node(
186 package=
"controller_manager",
187 executable=
"ros2_control_node",
188 parameters=[robot_description, ros2_controllers_path],
192 joint_state_broadcaster_spawner = Node(
193 package=
"controller_manager",
194 executable=
"spawner",
196 "joint_state_broadcaster",
197 "--controller-manager",
198 "/controller_manager",
202 panda_joint_group_position_controller_spawner = Node(
203 package=
"controller_manager",
204 executable=
"spawner",
206 "panda_joint_group_position_controller",
208 "/controller_manager",
216 robot_state_publisher,
218 joint_state_broadcaster_spawner,
219 panda_joint_group_position_controller_spawner,
222 return launched_nodes
def get_package_share_directory(pkg_name)
def get_robot_description_semantic()
def load_yaml(package_name, file_path)
def generate_common_hybrid_launch_description()
def get_robot_description()
def load_file(package_name, file_path)