Skip to content

Commit b9478c0

Browse files
committed
change pick_place_harmonic.launch.py
1 parent dd02c3e commit b9478c0

3 files changed

Lines changed: 38 additions & 110 deletions

File tree

Industrial/ur5_gripper_moveit_config/srdf/ur_gripper_macro.srdf.xacro

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@
6060
<!--END EFFECTOR - Purpose - Represent information about an end effector.-->
6161
<end_effector name="gripper" parent_link="${prefix}tool0" group="gripper" parent_group="${prefix}${name}_manipulator" />
6262

63+
<!-- PASSIVE JOINTS (FIX para mimic joints) -->
64+
<passive_joint name="robotiq_85_right_knuckle_joint"/>
65+
<passive_joint name="robotiq_85_left_inner_knuckle_joint"/>
66+
<passive_joint name="robotiq_85_right_inner_knuckle_joint"/>
67+
<passive_joint name="robotiq_85_left_finger_tip_joint"/>
68+
<passive_joint name="robotiq_85_right_finger_tip_joint"/>
69+
6370
<!--VIRTUAL JOINT - Purpose - this element defines a virtual joint between a robot link and an external frame of reference (considered fixed with respect to the robot)-->
6471
<!--PASSIVE JOINTS - MoveIt automatically detects mimic joints from URDF, don't declare them here -->
6572
<!-- Mimic joints (robotiq_85_right_knuckle_joint, robotiq_85_left_inner_knuckle_joint, etc.)

Launchers/pick_place_harmonic/pick_place_harmonic.launch.py

Lines changed: 10 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22

33
"""
4-
Pick Place Harmonic - FIXED (with correct XACRO → URDF)
4+
Pick Place Harmonic - CLASSIC MODE (NO MoveIt)
55
"""
66

77
import os
@@ -50,7 +50,7 @@ def generate_launch_description():
5050
)
5151

5252
# =========================
53-
# XACRO
53+
# XACRO → URDF
5454
# =========================
5555

5656
xacro_file = "/home/ws/src/Industrial/ros2_SimRealRobotControl_gz/packages/ur5/ros2srrc_ur5_gazebo/urdf/ur5_robotiq_2f85.urdf.xacro"
@@ -65,7 +65,7 @@ def generate_launch_description():
6565
}
6666

6767
# =========================
68-
# SRDF + CONFIG
68+
# CONFIG (necesario para execution)
6969
# =========================
7070

7171
robot_description_semantic = {
@@ -82,57 +82,8 @@ def generate_launch_description():
8282
)
8383
}
8484

85-
joint_limits = {
86-
"robot_description_planning": load_yaml(
87-
"ros2srrc_robots",
88-
"ur5/config/joint_limits.yaml"
89-
)
90-
}
91-
92-
moveit_controllers = {
93-
"moveit_simple_controller_manager": load_yaml(
94-
"ros2srrc_robots",
95-
"ur5/config/controller_moveit2.yaml"
96-
),
97-
"moveit_controller_manager": "moveit_simple_controller_manager/MoveItSimpleControllerManager",
98-
}
99-
100-
trajectory_execution = {
101-
"moveit_manage_controllers": True,
102-
"trajectory_execution.allowed_execution_duration_scaling": 1.2,
103-
"trajectory_execution.allowed_goal_duration_margin": 0.5,
104-
"trajectory_execution.allowed_start_tolerance": 0.01,
105-
}
106-
107-
planning_scene_monitor_parameters = {
108-
"publish_planning_scene": True,
109-
"publish_geometry_updates": True,
110-
"publish_state_updates": True,
111-
"publish_transforms_updates": True,
112-
}
113-
114-
# =========================
115-
# MOVE GROUP
116-
# =========================
117-
118-
move_group_node = Node(
119-
package="moveit_ros_move_group",
120-
executable="move_group",
121-
output="screen",
122-
parameters=[
123-
robot_description,
124-
robot_description_semantic,
125-
kinematics_yaml,
126-
joint_limits,
127-
moveit_controllers,
128-
trajectory_execution,
129-
planning_scene_monitor_parameters,
130-
{"use_sim_time": True},
131-
],
132-
)
133-
13485
# =========================
135-
# EXECUTION NODES
86+
# EXECUTION NODES (CLAVE)
13687
# =========================
13788

13889
robmove_node = Node(
@@ -176,17 +127,17 @@ def generate_launch_description():
176127
],
177128
)
178129

130+
# =========================
131+
# LAUNCH
132+
# =========================
133+
179134
return LaunchDescription([
180135
world_launch,
181136
robot_launch,
182137

138+
# Espera corta para que Gazebo arranque
183139
TimerAction(
184-
period=3.0,
185-
actions=[move_group_node]
186-
),
187-
188-
TimerAction(
189-
period=10.0,
140+
period=2.0,
190141
actions=[robmove_node, robpose_node, move_node]
191142
)
192143
])
Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,35 @@
1-
#!/usr/bin/env python3
1+
"""
2+
Pick Place Harmonic - Robot Launcher
3+
Wraps spawn_robot_warehouse.launch.py
4+
"""
25

36
import os
4-
import xacro
5-
67
from launch import LaunchDescription
7-
from launch_ros.actions import Node
8+
from launch.actions import IncludeLaunchDescription
9+
from launch.launch_description_sources import PythonLaunchDescriptionSource
810
from ament_index_python.packages import get_package_share_directory
911

1012

1113
def generate_launch_description():
1214

13-
pkg = get_package_share_directory("ros2srrc_ur5_gazebo")
14-
15-
xacro_file = os.path.join(pkg, "urdf", "ur5_robotiq_2f85.urdf.xacro")
16-
17-
doc = xacro.parse(open(xacro_file))
18-
xacro.process_doc(doc, mappings={
19-
"EE": "true",
20-
"EE_name": "robotiq_2f85"
21-
})
15+
try:
16+
ur5_gripper_pkg = get_package_share_directory("ur5_gripper_description")
17+
except Exception as e:
18+
print(f"ERROR: Cannot find ur5_gripper_description package: {e}")
19+
print("Make sure packages are built in /home/ws")
20+
raise
2221

23-
robot_description = {
24-
"robot_description": doc.toxml()
25-
}
26-
27-
robot_state_publisher = Node(
28-
package="robot_state_publisher",
29-
executable="robot_state_publisher",
30-
output="screen",
31-
parameters=[robot_description, {"use_sim_time": True}],
22+
warehouse_launch_file = os.path.join(
23+
ur5_gripper_pkg, "launch", "spawn_robot_warehouse.launch.py"
3224
)
3325

34-
spawn_entity = Node(
35-
package="gazebo_ros",
36-
executable="spawn_entity.py",
37-
arguments=["-topic", "robot_description", "-entity", "ur5"],
38-
output="screen",
39-
)
40-
41-
joint_state_broadcaster = Node(
42-
package="controller_manager",
43-
executable="spawner",
44-
arguments=["joint_state_broadcaster", "-c", "/controller_manager"],
45-
)
46-
47-
joint_trajectory_controller = Node(
48-
package="controller_manager",
49-
executable="spawner",
50-
arguments=["joint_trajectory_controller", "-c", "/controller_manager"],
51-
)
26+
print(f"Including launch file: {warehouse_launch_file}")
5227

53-
gripper_controller = Node(
54-
package="controller_manager",
55-
executable="spawner",
56-
arguments=["gripper_controller", "-c", "/controller_manager"],
28+
warehouse_launch = IncludeLaunchDescription(
29+
PythonLaunchDescriptionSource(warehouse_launch_file),
30+
launch_arguments={
31+
"launch_rviz": "false",
32+
}.items(),
5733
)
5834

59-
return LaunchDescription([
60-
robot_state_publisher,
61-
spawn_entity,
62-
joint_state_broadcaster,
63-
joint_trajectory_controller,
64-
gripper_controller,
65-
])
35+
return LaunchDescription([warehouse_launch])

0 commit comments

Comments
 (0)