68
69 ur_type = "ur5e"
70
71
72 runtime_config_package = LaunchConfiguration("runtime_config_package")
73 controllers_file = LaunchConfiguration("controllers_file")
74 description_package = LaunchConfiguration("description_package")
75 description_file = LaunchConfiguration("description_file")
76 moveit_config_package = LaunchConfiguration("moveit_config_package")
77 moveit_config_file = LaunchConfiguration("moveit_config_file")
78 prefix = LaunchConfiguration("prefix")
79
80 robot_description_content = Command(
81 [
82 PathJoinSubstitution([FindExecutable(name="xacro")]),
83 " ",
84 PathJoinSubstitution(
85 [FindPackageShare(description_package), "urdf", description_file]
86 ),
87 " ",
88 "name:=",
89 "ur",
90 " ",
91 "ur_type:=",
92 ur_type,
93 " ",
94 "prefix:=",
95 prefix,
96 " ",
97 ]
98 )
99 robot_description = {"robot_description": robot_description_content}
100
101
102 robot_description_semantic_content = Command(
103 [
104 PathJoinSubstitution([FindExecutable(name="xacro")]),
105 " ",
106 PathJoinSubstitution(
107 [FindPackageShare(moveit_config_package), "srdf", moveit_config_file]
108 ),
109 " ",
110 "name:=",
111 "ur",
112 " ",
113 "ur_type:=",
114 ur_type,
115 " ",
116 "prefix:=",
117 prefix,
118 " ",
119 ]
120 )
121 robot_description_semantic = {"robot_description_semantic": robot_description_semantic_content}
122
123 kinematics_yaml =
load_yaml(
"ur_moveit_config",
"config/kinematics.yaml")
124 robot_description_kinematics = {"robot_description_kinematics": kinematics_yaml}
125
126 smacc2_sm_config = PathJoinSubstitution(
127 [
128 FindPackageShare("sm_test_moveit_ur5_sim"),
129 "config",
130 "sm_test_moveit_ur5_sim_config.yaml",
131 ]
132 )
133
134 sm_test_moveit_ur5_sim_node = Node(
135 package="sm_test_moveit_ur5_sim",
136 executable="sm_test_moveit_ur5_sim_node",
137
138 prefix="xterm -xrm 'XTerm*scrollBar: true' -xrm 'xterm*rightScrollBar: true' -hold -sl 10000 -geometry 1000x600 -e",
139 parameters=[
140 {"use_sim_time": True},
141 robot_description,
142 robot_description_semantic,
143 robot_description_kinematics,
144 smacc2_sm_config,
145 ],
146 )
147
148 smacc2_sm_rviz = PathJoinSubstitution(
149 [
150 FindPackageShare("sm_test_moveit_ur5_sim"),
151 "rviz",
152 "rviz.rviz",
153 ]
154 )
155
156
157 start_rviz_cmd = Node(
158 package="rviz2",
159 executable="rviz2",
160 name="rviz2",
161 arguments=["-d", smacc2_sm_rviz],
162 output="screen",
163 parameters=[
164 {"use_sim_time": True},
165 robot_description,
166 robot_description_semantic,
167 robot_description_kinematics,
168 ],
169 )
170
171 ur_control_launch = IncludeLaunchDescription(
172 PythonLaunchDescriptionSource(
173 [FindPackageShare("ur_simulation_gazebo"), "/launch", "/ur_sim_control.launch.py"]
174 ),
175 launch_arguments={
176 "ur_type": ur_type,
177 "runtime_config_package": runtime_config_package,
178 "controllers_file": controllers_file,
179 "description_package": description_package,
180 "description_file": description_file,
181 "prefix": prefix,
182 "launch_rviz": "false",
183 }.items(),
184 )
185
186 ur_moveit_launch = IncludeLaunchDescription(
187 PythonLaunchDescriptionSource(
188 [FindPackageShare("ur_moveit_config"), "/launch", "/ur_moveit.launch.py"]
189 ),
190 launch_arguments={
191 "ur_type": ur_type,
192 "description_package": description_package,
193 "description_file": description_file,
194 "moveit_config_package": moveit_config_package,
195 "moveit_config_file": moveit_config_file,
196 "use_sim_time": "true",
197 "prefix": prefix,
198 "launch_rviz": "false",
199 }.items(),
200 )
201
202 nodes_to_launch = [
203 ur_control_launch,
204 ur_moveit_launch,
205 sm_test_moveit_ur5_sim_node,
206 start_rviz_cmd,
207 ]
208
209 return nodes_to_launch
210
211
def launch_setup(context, *args, **kwargs)
def load_yaml(package_name, file_path)