Skip to content

Commit 5d1af17

Browse files
destoglAndyZe
andauthored
Use Launch Arguments to reuse the files (#58)
* Launch Arguments for xacro are working, not all params added * Moved files and one step further with the Arguemnts * Add launch for all version of UR robots * Minor comment and xacro cleanup Co-authored-by: AndyZe <[email protected]>
1 parent 3506801 commit 5d1af17

23 files changed

+1129
-116
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ Code is auto-formatted with clang-format 10 whenever a git commit is made. Pleas
8383
Prepare the pre-commit formatting to run like this:
8484

8585
`pre-commit install`
86+
87+
88+
## Stuff to add
89+
90+
1. Explation of packages
91+
2. How to start:
92+
- Simple simulation with FakeSystem
93+
- Hardware
94+
95+
3. How to test:
96+
- Using forward_command_controller
97+
- Using joint_trajectory_controller

ur_description/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ project(ur_description)
33

44
find_package(ament_cmake REQUIRED)
55

6-
install(DIRECTORY launch DESTINATION share/${PROJECT_NAME})
7-
install(DIRECTORY urdf DESTINATION share/${PROJECT_NAME})
8-
install(DIRECTORY meshes DESTINATION share/${PROJECT_NAME})
9-
install(DIRECTORY config DESTINATION share/${PROJECT_NAME})
6+
install(
7+
DIRECTORY config meshes launch urdf rviz
8+
DESTINATION share/${PROJECT_NAME}
9+
)
1010

1111
ament_export_dependencies(${THIS_PACKAGE_INCLUDE_DEPENDS})
1212

ur_description/config/rviz/view_robot.rviz renamed to ur_description/rviz/view_robot.rviz

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Panels:
22
- Class: rviz_common/Displays
3-
Help Height: 78
3+
Help Height: 87
44
Name: Displays
55
Property Tree Widget:
66
Expanded:
77
- /RobotModel1/Description Topic1
88
Splitter Ratio: 0.5
9-
Tree Height: 623
9+
Tree Height: 1096
1010
- Class: rviz_common/Selection
1111
Name: Selection
1212
- Class: rviz_common/Tool Properties
@@ -67,12 +67,15 @@ Visualization Manager:
6767
Alpha: 1
6868
Show Axes: false
6969
Show Trail: false
70-
Value: true
71-
ee_link:
70+
base_link_inertia:
7271
Alpha: 1
7372
Show Axes: false
7473
Show Trail: false
7574
Value: true
75+
flange:
76+
Alpha: 1
77+
Show Axes: false
78+
Show Trail: false
7679
forearm_link:
7780
Alpha: 1
7881
Show Axes: false
@@ -92,10 +95,6 @@ Visualization Manager:
9295
Show Axes: false
9396
Show Trail: false
9497
Value: true
95-
world:
96-
Alpha: 1
97-
Show Axes: false
98-
Show Trail: false
9998
wrist_1_link:
10099
Alpha: 1
101100
Show Axes: false
@@ -159,16 +158,16 @@ Visualization Manager:
159158
Views:
160159
Current:
161160
Class: rviz_default_plugins/Orbit
162-
Distance: 10
161+
Distance: 3.493516445159912
163162
Enable Stereo Rendering:
164163
Stereo Eye Separation: 0.05999999865889549
165164
Stereo Focal Distance: 1
166165
Swap Stereo Eyes: false
167166
Value: false
168167
Focal Point:
169-
X: 0
170-
Y: 0
171-
Z: 0
168+
X: -0.0457618348300457
169+
Y: -0.07058511674404144
170+
Z: 0.49734944105148315
172171
Focal Shape Fixed Size: true
173172
Focal Shape Size: 0.05000000074505806
174173
Invert Z Axis: false
@@ -182,16 +181,16 @@ Visualization Manager:
182181
Window Geometry:
183182
Displays:
184183
collapsed: false
185-
Height: 846
184+
Height: 1379
186185
Hide Left Dock: false
187186
Hide Right Dock: false
188-
QMainWindow State: 000000ff00000000fd000000040000000000000156000002f8fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002f8000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002f8fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000002f8000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d006501000000000000045000000000000000000000023f000002f800000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
187+
QMainWindow State: 000000ff00000000fd00000004000000000000016a000004f0fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000007901000003fb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c0061007900730100000048000004f00000010101000003fb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c000002610000000100000110000004f0fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a005600690065007700730100000048000004f0000000db01000003fb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d0065010000000000000450000000000000000000000784000004f000000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
189188
Selection:
190189
collapsed: false
191190
Tool Properties:
192191
collapsed: false
193192
Views:
194193
collapsed: false
195-
Width: 1200
196-
X: 446
197-
Y: 473
194+
Width: 2560
195+
X: 0
196+
Y: 30

ur_description/urdf/inc/ur_common.xacro

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<?xml version="1.0"?>
22
<robot xmlns:xacro="http://wiki.ros.org/xacro">
33
<!--
4-
NOTE: the macros defined in this file are NOT part of the public API of this
5-
package. Users CANNOT rely on this file being available, or stored in
6-
this location. Nor can they rely on the existence of the two macros.
4+
NOTE the macros defined in this file are NOT part of the public API of this
5+
package. Users CANNOT rely on this file being available, or stored in
6+
this location. Nor can they rely on the existence of the two macros.
7+
The macros store the defined properties in the scope of the caller.
8+
However, users MUST NOT rely on these properties, their contents or their
9+
names.
710
811
Author: Ludovic Delval
912
Contributor: Felix Messmer
@@ -18,15 +21,6 @@
1821
</inertial>
1922
</xacro:macro>
2023

21-
22-
<!--
23-
NOTE: this macro stores the defined properties in the scope of the caller.
24-
However, users MUST NOT rely on these properties, their contents or
25-
their names.
26-
27-
This macro is NOT part of the public API of the ur_description pkg,
28-
and as such should be considered to be for internal use only.
29-
-->
3024
<xacro:macro name="read_model_data" params="joint_limits_parameters_file kinematics_parameters_file physical_parameters_file visual_parameters_file">
3125
<!-- Read .yaml files from disk, load content into properties -->
3226
<xacro:property name="__joint_limit_parameters" value="${load_yaml(joint_limits_parameters_file)}"/>

ur_description/urdf/inc/ur_transmissions.xacro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0"?>
22
<robot xmlns:xacro="http://wiki.ros.org/xacro">
33
<!--
4-
NOTE: the macro defined in this file is NOT part of the public API of this
4+
NOTE the macro defined in this file is NOT part of the public API of this
55
package. Users CANNOT rely on this file being available, or stored in
66
this location. Nor can they rely on the existence of the macro.
77
-->

ur_ros2_control_demos/urdf/ur.ros2_control.xacro renamed to ur_description/urdf/ur.ros2_control.xacro

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,44 @@
22
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
33

44
<xacro:macro name="ur5_system_position_only" params="name prefix
5+
use_fake_hardware:=^|false fake_sensor_commands:=^|false
56
script_filename output_recipe_filename
67
input_recipe_filename tf_prefix
78
hash_kinematics robot_ip">
89

910
<ros2_control name="${name}" type="system">
1011
<hardware>
11-
<plugin>ur_robot_driver/URPositionHardwareInterface</plugin>
12-
<param name="robot_ip">${robot_ip}</param>
13-
<param name="script_filename">${script_filename}</param>
14-
<param name="output_recipe_filename">${output_recipe_filename}</param>
15-
<param name="input_recipe_filename">${input_recipe_filename}</param>
16-
<param name="headless_mode">0</param>
17-
<param name="reverse_port">50001</param>
18-
<param name="script_sender_port">50002</param>
19-
<param name="tf_prefix">"${tf_prefix}"</param>
20-
<param name="non_blocking_read">0</param>
21-
<param name="servoj_gain">2000</param>
22-
<param name="servoj_lookahead_time">0.03</param>
23-
<param name="use_tool_communication">0</param>
24-
<param name="kinematics/hash">"${hash_kinematics}"</param>
25-
<param name="tool_voltage">0</param>
26-
<param name="tool_parity">0</param>
27-
<param name="tool_baud_rate">115200</param>
28-
<param name="tool_stop_bits">1</param>
29-
<param name="tool_rx_idle_chars">1.5</param>
30-
<param name="tool_tx_idle_chars">3.5</param>
31-
<param name="tool_device_name">/tmp/ttyUR</param>
32-
<param name="tool_tcp_port">54321</param>
12+
<xacro:if value="${use_fake_hardware}">
13+
<plugin>fake_components/GenericSystem</plugin>
14+
<param name="fake_sensor_commands">${fake_sensor_commands}</param>
15+
<param name="state_following_offset">0.0</param>
16+
</xacro:if>
17+
<xacro:unless value="${use_fake_hardware}">
18+
<plugin>ur_robot_driver/URPositionHardwareInterface</plugin>
19+
<param name="robot_ip">${robot_ip}</param>
20+
<param name="script_filename">${script_filename}</param>
21+
<param name="output_recipe_filename">${output_recipe_filename}</param>
22+
<param name="input_recipe_filename">${input_recipe_filename}</param>
23+
<param name="headless_mode">0</param>
24+
<param name="reverse_port">50001</param>
25+
<param name="script_sender_port">50002</param>
26+
<param name="tf_prefix">"${tf_prefix}"</param>
27+
<param name="non_blocking_read">0</param>
28+
<param name="servoj_gain">2000</param>
29+
<param name="servoj_lookahead_time">0.03</param>
30+
<param name="use_tool_communication">0</param>
31+
<param name="kinematics/hash">"${hash_kinematics}"</param>
32+
<param name="tool_voltage">0</param>
33+
<param name="tool_parity">0</param>
34+
<param name="tool_baud_rate">115200</param>
35+
<param name="tool_stop_bits">1</param>
36+
<param name="tool_rx_idle_chars">1.5</param>
37+
<param name="tool_tx_idle_chars">3.5</param>
38+
<param name="tool_device_name">/tmp/ttyUR</param>
39+
<param name="tool_tcp_port">54321</param>
40+
</xacro:unless>
3341
</hardware>
34-
<joint name="shoulder_pan_joint">
42+
<joint name="${prefix}shoulder_pan_joint">
3543
<command_interface name="position">
3644
<param name="min">{-2*pi}</param>
3745
<param name="max">{2*pi}</param>
@@ -44,7 +52,7 @@
4452
<state_interface name="velocity"/>
4553
<state_interface name="effort"/>
4654
</joint>
47-
<joint name="shoulder_lift_joint">
55+
<joint name="${prefix}shoulder_lift_joint">
4856
<command_interface name="position">
4957
<param name="min">{-2*pi}</param>
5058
<param name="max">{2*pi}</param>
@@ -56,8 +64,9 @@
5664
<state_interface name="position"/>
5765
<state_interface name="velocity"/>
5866
<state_interface name="effort"/>
67+
<param name="initial_position">-1.57</param> <!-- initial position for the FakeSystem -->
5968
</joint>
60-
<joint name="elbow_joint">
69+
<joint name="${prefix}elbow_joint">
6170
<command_interface name="position">
6271
<param name="min">{-pi}</param>
6372
<param name="max">{pi}</param>
@@ -70,7 +79,7 @@
7079
<state_interface name="velocity"/>
7180
<state_interface name="effort"/>
7281
</joint>
73-
<joint name="wrist_1_joint">
82+
<joint name="${prefix}wrist_1_joint">
7483
<command_interface name="position">
7584
<param name="min">{-2*pi}</param>
7685
<param name="max">{2*pi}</param>
@@ -83,7 +92,7 @@
8392
<state_interface name="velocity"/>
8493
<state_interface name="effort"/>
8594
</joint>
86-
<joint name="wrist_2_joint">
95+
<joint name="${prefix}wrist_2_joint">
8796
<command_interface name="position">
8897
<param name="min">{-2*pi}</param>
8998
<param name="max">{2*pi}</param>
@@ -96,7 +105,7 @@
96105
<state_interface name="velocity"/>
97106
<state_interface name="effort"/>
98107
</joint>
99-
<joint name="wrist_3_joint">
108+
<joint name="${prefix}wrist_3_joint">
100109
<command_interface name="position">
101110
<param name="min">{-2*pi}</param>
102111
<param name="max">{2*pi}</param>
@@ -110,12 +119,12 @@
110119
<state_interface name="effort"/>
111120
</joint>
112121
<sensor name="tcp_fts_sensor">
113-
<state_interface name="fx"/>
114-
<state_interface name="fy"/>
115-
<state_interface name="fz"/>
116-
<state_interface name="tx"/>
117-
<state_interface name="ty"/>
118-
<state_interface name="tz"/>
122+
<state_interface name="force.x"/>
123+
<state_interface name="force.y"/>
124+
<state_interface name="force.z"/>
125+
<state_interface name="torque.x"/>
126+
<state_interface name="torque.y"/>
127+
<state_interface name="torque.z"/>
119128
</sensor>
120129
</ros2_control>
121130
</xacro:macro>

ur_description/urdf/ur.xacro renamed to ur_description/urdf/ur.urdf.xacro

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<xacro:include filename="$(find ur_description)/urdf/ur_macro.xacro"/>
77

88
<!-- parameters -->
9+
<xacro:arg name="prefix" default="" />
910
<xacro:arg name="joint_limit_params" default=""/>
1011
<xacro:arg name="kinematics_params" default=""/>
1112
<xacro:arg name="physical_params" default=""/>
@@ -14,16 +15,21 @@
1415
<xacro:arg name="safety_limits" default="false"/>
1516
<xacro:arg name="safety_pos_margin" default="0.15"/>
1617
<xacro:arg name="safety_k_position" default="20"/>
18+
<!-- ros2_control related parameters -->
19+
<xacro:arg name="use_fake_hardware" default="false" />
20+
<xacro:arg name="fake_sensor_commands" default="false" />
1721

1822
<!-- arm -->
1923
<xacro:ur_robot
20-
prefix=""
24+
prefix="$(arg prefix)"
2125
joint_limits_parameters_file="$(arg joint_limit_params)"
2226
kinematics_parameters_file="$(arg kinematics_params)"
2327
physical_parameters_file="$(arg physical_params)"
2428
visual_parameters_file="$(arg visual_params)"
2529
transmission_hw_interface="$(arg transmission_hw_interface)"
2630
safety_limits="$(arg safety_limits)"
2731
safety_pos_margin="$(arg safety_pos_margin)"
28-
safety_k_position="$(arg safety_k_position)"/>
32+
safety_k_position="$(arg safety_k_position)"
33+
use_fake_hardware="$(arg use_fake_hardware)"
34+
fake_sensor_commands="$(arg fake_sensor_commands)" />
2935
</robot>

ur_description/urdf/ur5.urdf.xacro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@
355355
<link name="${prefix}base"/>
356356
<joint name="${prefix}base_link-base_fixed_joint" type="fixed">
357357
<!-- NOTE: this rotation is only needed as long as base_link itself is
358-
not corrected wrt the real robot (ie: rotated over 180
358+
not corrected wrt the real robot (i.e., rotated over 180
359359
degrees)
360360
-->
361361
<origin xyz="0 0 0" rpy="0 0 ${-pi}"/>

0 commit comments

Comments
 (0)