Skip to content

Commit 493b373

Browse files
committed
prepared launch
1 parent f52a6f5 commit 493b373

File tree

5 files changed

+363
-21
lines changed

5 files changed

+363
-21
lines changed

robotiq_hande_driver/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ install(
4141
DESTINATION include/
4242
)
4343
install(
44-
DIRECTORY config
44+
DIRECTORY bringup
4545
DESTINATION share/${PROJECT_NAME}
4646
)
4747

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**:
2+
controller_manager:
3+
ros__parameters:
4+
update_rate: 10 # Hz
5+
6+
joint_state_broadcaster:
7+
type: joint_state_broadcaster/JointStateBroadcaster
8+
9+
gripper_action_controller:
10+
type: position_controllers/GripperActionController
11+
12+
gripper_action_controller:
13+
ros__parameters:
14+
action_monitor_rate: 20.0 # Hz
15+
joint: $(var tf_prefix)robotiq_hande_left_finger_joint
16+
max_effort: 10.0 # N
17+
goal_tolerance: 0.01 # m
18+
allow_stalling: false
19+
stall_velocity_threshold: 0.001 #m/s
20+
stall_timeout: 1.0 # s
21+
state_interfaces:
22+
- position
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
Panels:
2+
- Class: rviz_common/Displays
3+
Help Height: 78
4+
Name: Displays
5+
Property Tree Widget:
6+
Expanded:
7+
- /Global Options1
8+
- /Status1
9+
- /RobotModel1
10+
Splitter Ratio: 0.5
11+
Tree Height: 2233
12+
- Class: rviz_common/Selection
13+
Name: Selection
14+
- Class: rviz_common/Tool Properties
15+
Expanded:
16+
- /2D Goal Pose1
17+
- /Publish Point1
18+
Name: Tool Properties
19+
Splitter Ratio: 0.5886790156364441
20+
- Class: rviz_common/Views
21+
Expanded:
22+
- /Current View1
23+
Name: Views
24+
Splitter Ratio: 0.5
25+
- Class: rviz_common/Time
26+
Experimental: false
27+
Name: Time
28+
SyncMode: 0
29+
SyncSource: ""
30+
Visualization Manager:
31+
Class: ""
32+
Displays:
33+
- Alpha: 0.5
34+
Cell Size: 1
35+
Class: rviz_default_plugins/Grid
36+
Color: 160; 160; 164
37+
Enabled: true
38+
Line Style:
39+
Line Width: 0.029999999329447746
40+
Value: Lines
41+
Name: Grid
42+
Normal Cell Count: 0
43+
Offset:
44+
X: 0
45+
Y: 0
46+
Z: 0
47+
Plane: XY
48+
Plane Cell Count: 10
49+
Reference Frame: <Fixed Frame>
50+
Value: true
51+
- Alpha: 1
52+
Class: rviz_default_plugins/RobotModel
53+
Collision Enabled: false
54+
Description File: ""
55+
Description Source: Topic
56+
Description Topic:
57+
Depth: 5
58+
Durability Policy: Volatile
59+
History Policy: Keep Last
60+
Reliability Policy: Reliable
61+
Value: /robot_description
62+
Enabled: true
63+
Links:
64+
All Links Enabled: true
65+
Expand Joint Details: false
66+
Expand Link Details: false
67+
Expand Tree: false
68+
Link Tree Style: Links in Alphabetic Order
69+
robotiq_hande_coupler:
70+
Alpha: 1
71+
Show Axes: false
72+
Show Trail: false
73+
Value: true
74+
robotiq_hande_end:
75+
Alpha: 1
76+
Show Axes: false
77+
Show Trail: false
78+
robotiq_hande_left_finger:
79+
Alpha: 1
80+
Show Axes: false
81+
Show Trail: false
82+
Value: true
83+
robotiq_hande_link:
84+
Alpha: 1
85+
Show Axes: false
86+
Show Trail: false
87+
Value: true
88+
robotiq_hande_right_finger:
89+
Alpha: 1
90+
Show Axes: false
91+
Show Trail: false
92+
Value: true
93+
tool0:
94+
Alpha: 1
95+
Show Axes: false
96+
Show Trail: false
97+
Mass Properties:
98+
Inertia: false
99+
Mass: false
100+
Name: RobotModel
101+
TF Prefix: ""
102+
Update Interval: 0
103+
Value: true
104+
Visual Enabled: true
105+
Enabled: true
106+
Global Options:
107+
Background Color: 48; 48; 48
108+
Fixed Frame: tool0
109+
Frame Rate: 30
110+
Name: root
111+
Tools:
112+
- Class: rviz_default_plugins/Interact
113+
Hide Inactive Objects: true
114+
- Class: rviz_default_plugins/MoveCamera
115+
- Class: rviz_default_plugins/Select
116+
- Class: rviz_default_plugins/FocusCamera
117+
- Class: rviz_default_plugins/Measure
118+
Line color: 128; 128; 0
119+
- Class: rviz_default_plugins/SetInitialPose
120+
Covariance x: 0.25
121+
Covariance y: 0.25
122+
Covariance yaw: 0.06853891909122467
123+
Topic:
124+
Depth: 5
125+
Durability Policy: Volatile
126+
History Policy: Keep Last
127+
Reliability Policy: Reliable
128+
Value: /initialpose
129+
- Class: rviz_default_plugins/SetGoal
130+
Topic:
131+
Depth: 5
132+
Durability Policy: Volatile
133+
History Policy: Keep Last
134+
Reliability Policy: Reliable
135+
Value: /goal_pose
136+
- Class: rviz_default_plugins/PublishPoint
137+
Single click: true
138+
Topic:
139+
Depth: 5
140+
Durability Policy: Volatile
141+
History Policy: Keep Last
142+
Reliability Policy: Reliable
143+
Value: /clicked_point
144+
Transformation:
145+
Current:
146+
Class: rviz_default_plugins/TF
147+
Value: true
148+
Views:
149+
Current:
150+
Class: rviz_default_plugins/Orbit
151+
Distance: 0.5352108478546143
152+
Enable Stereo Rendering:
153+
Stereo Eye Separation: 0.05999999865889549
154+
Stereo Focal Distance: 1
155+
Swap Stereo Eyes: false
156+
Value: false
157+
Focal Point:
158+
X: 0
159+
Y: 0
160+
Z: 0
161+
Focal Shape Fixed Size: false
162+
Focal Shape Size: 0.05000000074505806
163+
Invert Z Axis: false
164+
Name: Current View
165+
Near Clip Distance: 0.009999999776482582
166+
Pitch: 0.46039843559265137
167+
Target Frame: <Fixed Frame>
168+
Value: Orbit (rviz)
169+
Yaw: 4.508580684661865
170+
Saved: ~
171+
Window Geometry:
172+
Displays:
173+
collapsed: false
174+
Height: 2531
175+
Hide Left Dock: false
176+
Hide Right Dock: true
177+
QMainWindow State: 000000ff00000000fd0000000400000000000001ac00000944fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005d00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003e00000944000000cb00fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f00000944fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073000000003e00000944000000a500fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000005a00000003efc0100000002fb0000000800540069006d00650100000000000005a00000027900fffffffb0000000800540069006d00650100000000000004500000000000000000000003ee0000094400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
178+
Selection:
179+
collapsed: false
180+
Time:
181+
collapsed: false
182+
Tool Properties:
183+
collapsed: false
184+
Views:
185+
collapsed: true
186+
Width: 1440
187+
X: 0
188+
Y: 0
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
from launch import LaunchDescription, LaunchContext
2+
from launch.actions import (
3+
DeclareLaunchArgument,
4+
IncludeLaunchDescription,
5+
OpaqueFunction,
6+
)
7+
from launch.conditions import IfCondition
8+
from launch.substitutions import (
9+
Command,
10+
FindExecutable,
11+
PathJoinSubstitution,
12+
LaunchConfiguration,
13+
)
14+
15+
from launch_ros.actions import Node
16+
from launch_ros.descriptions import ParameterValue
17+
from launch_ros.parameter_descriptions import ParameterFile
18+
from launch_ros.substitutions import FindPackageShare
19+
20+
21+
def generate_launch_description():
22+
declared_arguments = []
23+
declared_arguments.append(
24+
DeclareLaunchArgument(
25+
"launch_rviz",
26+
default_value="true",
27+
description="Launch RViz for the gripper visualization.",
28+
)
29+
)
30+
declared_arguments.append(
31+
DeclareLaunchArgument(
32+
"use_fake_hardware",
33+
default_value="true",
34+
description="Use fake hardware for preview.",
35+
)
36+
)
37+
declared_arguments.append(
38+
DeclareLaunchArgument(
39+
"tf_prefix",
40+
default_value="",
41+
description="transforms prefix",
42+
)
43+
)
44+
45+
return LaunchDescription(
46+
declared_arguments + [OpaqueFunction(function=launch_setup)]
47+
)
48+
49+
50+
def launch_setup(context: LaunchContext) -> list[IncludeLaunchDescription]:
51+
52+
tf_prefix = LaunchConfiguration("tf_prefix", default="")
53+
54+
robot_state_pub_node = prepare_robot_state_publisher_node()
55+
control_node = preapre_control_node()
56+
rviz_node = prepare_rviz_node(enable=LaunchConfiguration("launch_rviz"))
57+
58+
joint_state_broadcaster_spawner = Node(
59+
package="controller_manager",
60+
executable="spawner",
61+
arguments=[
62+
"joint_state_broadcaster",
63+
"--controller-manager",
64+
"/controller_manager",
65+
],
66+
)
67+
68+
gripper_controller_spawner = Node(
69+
package="controller_manager",
70+
executable="spawner",
71+
arguments=["gripper_action_controller", "-c", "/controller_manager"],
72+
)
73+
74+
return [
75+
control_node,
76+
robot_state_pub_node,
77+
rviz_node,
78+
joint_state_broadcaster_spawner,
79+
gripper_controller_spawner,
80+
]
81+
82+
83+
def prepare_rviz_node(enable: LaunchConfiguration):
84+
rviz_config_file = PathJoinSubstitution(
85+
[
86+
FindPackageShare("robotiq_hande_driver"),
87+
"bringup",
88+
"config",
89+
"rviz_preview.rviz",
90+
]
91+
)
92+
return Node(
93+
package="rviz2",
94+
executable="rviz2",
95+
name="rviz2",
96+
output="log",
97+
arguments=["-d", rviz_config_file],
98+
condition=IfCondition(enable),
99+
)
100+
101+
def preapre_control_node() -> Node:
102+
robot_controllers = ParameterFile(
103+
PathJoinSubstitution(
104+
[
105+
FindPackageShare("robotiq_hande_driver"),
106+
"bringup",
107+
"config",
108+
"hande_controller.yaml",
109+
]
110+
),
111+
allow_substs=True,
112+
)
113+
114+
return Node(
115+
package="controller_manager",
116+
executable="ros2_control_node",
117+
parameters=[robot_controllers],
118+
remappings=[
119+
("~/robot_description", "/robot_description"),
120+
],
121+
output="both",
122+
)
123+
124+
125+
def prepare_robot_state_publisher_node() -> Node:
126+
tf_prefix = LaunchConfiguration("tf_prefix", default="")
127+
use_fake_hardware = LaunchConfiguration("use_fake_hardware")
128+
129+
robot_description_str = Command(
130+
[
131+
PathJoinSubstitution([FindExecutable(name="xacro")]),
132+
" ",
133+
PathJoinSubstitution(
134+
[
135+
FindPackageShare("robotiq_hande_description"),
136+
"urdf",
137+
"robotiq_hande_gripper.urdf.xacro",
138+
]
139+
),
140+
" ",
141+
"use_fake_hardware:=",
142+
use_fake_hardware,
143+
]
144+
)
145+
return Node(
146+
package="robot_state_publisher",
147+
executable="robot_state_publisher",
148+
output="both",
149+
parameters=[
150+
{"robot_description": ParameterValue(robot_description_str, value_type=str)}
151+
],
152+
)

robotiq_hande_driver/config/hande_controller.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)