3 from launch
import LaunchDescription
4 from launch.actions
import DeclareLaunchArgument
5 from launch.substitutions
import LaunchConfiguration
6 from launch.conditions
import IfCondition, UnlessCondition
7 from launch_ros.actions
import Node
8 from launch.actions
import ExecuteProcess
9 from ament_index_python.packages
import get_package_share_directory
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:
38 robot_description_config = xacro.process_file(
45 robot_description = {
"robot_description": robot_description_config.toxml()}
47 robot_description_semantic_config = xacro.process_file(
55 robot_description_semantic = {
56 "robot_description_semantic": robot_description_semantic_config.toxml()
60 "moveit_resources_prbt_moveit_config",
"config/joint_limits.yaml"
63 "moveit_resources_prbt_moveit_config",
"config/pilz_cartesian_limits.yaml"
65 robot_description_planning = {
66 "robot_description_planning": {
68 **pilz_cartesian_limits_yaml,
72 "moveit_resources_prbt_moveit_config",
"config/kinematics.yaml"
74 robot_description_kinematics = {
"robot_description_kinematics": kinematics_yaml}
77 planning_pipelines_config = {
78 "default_planning_pipeline":
"ompl",
79 "planning_pipelines": [
"pilz",
"ompl"],
81 "planning_plugin":
"pilz_industrial_motion_planner/CommandPlanner",
82 "request_adapters":
"",
83 "start_state_max_bounds_error": 0.1,
86 "planning_plugin":
"ompl_interface/OMPLPlanner",
87 "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""",
88 "start_state_max_bounds_error": 0.1,
92 "moveit_resources_prbt_moveit_config",
"config/ompl_planning.yaml"
94 planning_pipelines_config[
"ompl"].update(ompl_planning_yaml)
97 moveit_simple_controllers_yaml =
load_yaml(
98 "moveit_resources_prbt_moveit_config",
"config/prbt_controllers.yaml"
100 moveit_controllers = {
101 "moveit_simple_controller_manager": moveit_simple_controllers_yaml,
102 "moveit_controller_manager":
"moveit_simple_controller_manager/MoveItSimpleControllerManager",
105 trajectory_execution = {
106 "moveit_manage_controllers":
True,
107 "trajectory_execution.allowed_execution_duration_scaling": 1.2,
108 "trajectory_execution.allowed_goal_duration_margin": 0.5,
109 "trajectory_execution.allowed_start_tolerance": 0.01,
112 planning_scene_monitor_parameters = {
113 "publish_planning_scene":
True,
114 "publish_geometry_updates":
True,
115 "publish_state_updates":
True,
116 "publish_transforms_updates":
True,
120 run_move_group_node = Node(
121 package=
"moveit_ros_move_group",
122 executable=
"move_group",
126 robot_description_semantic,
127 robot_description_kinematics,
128 robot_description_planning,
129 planning_pipelines_config,
130 trajectory_execution,
132 planning_scene_monitor_parameters,
137 rviz_base = os.path.join(
140 rviz_full_config = os.path.join(rviz_base,
"moveit.rviz")
146 arguments=[
"-d", rviz_full_config],
149 robot_description_semantic,
150 robot_description_planning,
151 robot_description_kinematics,
152 planning_pipelines_config,
159 executable=
"static_transform_publisher",
160 name=
"static_transform_publisher",
162 arguments=[
"0.0",
"0.0",
"0.0",
"0.0",
"0.0",
"0.0",
"world",
"prbt_link0"],
166 robot_state_publisher = Node(
167 package=
"robot_state_publisher",
168 executable=
"robot_state_publisher",
169 name=
"robot_state_publisher",
171 parameters=[robot_description],
175 ros2_controllers_path = os.path.join(
178 "prbt_ros_controllers.yaml",
180 ros2_control_node = Node(
181 package=
"controller_manager",
182 executable=
"ros2_control_node",
183 parameters=[robot_description, ros2_controllers_path],
187 joint_state_broadcaster_spawner = Node(
188 package=
"controller_manager",
189 executable=
"spawner",
191 "joint_state_broadcaster",
192 "--controller-manager",
193 "/controller_manager",
197 prbt_arm_controller_spawner = Node(
198 package=
"controller_manager",
199 executable=
"spawner",
201 "panda_joint_group_position_controller",
203 "/controller_manager",
208 mongodb_server_node = Node(
209 package=
"warehouse_ros_mongo",
210 executable=
"mongo_wrapper_ros.py",
212 {
"warehouse_port": 33829},
213 {
"warehouse_host":
"localhost"},
214 {
"warehouse_plugin":
"warehouse_ros_mongo::MongoDatabaseConnection"},
219 return LaunchDescription(
223 robot_state_publisher,
226 joint_state_broadcaster_spawner,
227 prbt_arm_controller_spawner,
def get_package_share_directory(pkg_name)
def load_yaml(package_name, file_path)
def generate_launch_description()
def load_file(package_name, file_path)