Skip to content

Commit 007469a

Browse files
authored
Tool param propagation (#13)
* Propagate tool parameters. * Parameters to xacro macro.
1 parent 12e7b18 commit 007469a

File tree

3 files changed

+47
-12
lines changed

3 files changed

+47
-12
lines changed

urdf/ur.ros2_control.xacro

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
use_tool_communication:=false
1313
script_filename output_recipe_filename
1414
input_recipe_filename tf_prefix
15-
hash_kinematics robot_ip">
15+
hash_kinematics robot_ip
16+
tool_voltage:=24 tool_parity:=0 tool_baud_rate:=115200 tool_stop_bits:=1
17+
tool_rx_idle_chars:=1.5 tool_tx_idle_chars:=3.5 tool_device_name:=/tmp/ttyUR tool_tcp_port:=54321">
1618

1719
<ros2_control name="${name}" type="system">
1820
<hardware>
@@ -42,14 +44,14 @@
4244
<param name="servoj_lookahead_time">0.03</param>
4345
<param name="use_tool_communication">${use_tool_communication}</param>
4446
<param name="kinematics/hash">${hash_kinematics}</param>
45-
<param name="tool_voltage">0</param>
46-
<param name="tool_parity">0</param>
47-
<param name="tool_baud_rate">115200</param>
48-
<param name="tool_stop_bits">1</param>
49-
<param name="tool_rx_idle_chars">1.5</param>
50-
<param name="tool_tx_idle_chars">3.5</param>
51-
<param name="tool_device_name">/tmp/ttyUR</param>
52-
<param name="tool_tcp_port">54321</param>
47+
<param name="tool_voltage">${tool_voltage}</param>
48+
<param name="tool_parity">${tool_parity}</param>
49+
<param name="tool_baud_rate">${tool_baud_rate}</param>
50+
<param name="tool_stop_bits">${tool_stop_bits}</param>
51+
<param name="tool_rx_idle_chars">${tool_rx_idle_chars}</param>
52+
<param name="tool_tx_idle_chars">${tool_tx_idle_chars}</param>
53+
<param name="tool_device_name">${tool_device_name}</param>
54+
<param name="tool_tcp_port">${tool_tcp_port}</param>
5355
</xacro:unless>
5456
</hardware>
5557
<joint name="${prefix}shoulder_pan_joint">

urdf/ur.urdf.xacro

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,16 @@
1717
<xacro:arg name="safety_k_position" default="20"/>
1818
<!-- ros2_control related parameters -->
1919
<xacro:arg name="headless_mode" default="false" />
20+
<!-- tool communication related parameters-->
2021
<xacro:arg name="use_tool_communication" default="false" />
22+
<xacro:arg name="tool_voltage" default="24" />
23+
<xacro:arg name="tool_parity" default="0" />
24+
<xacro:arg name="tool_baud_rate" default="115200" />
25+
<xacro:arg name="tool_stop_bits" default="1" />
26+
<xacro:arg name="tool_rx_idle_chars" default="1.5" />
27+
<xacro:arg name="tool_tx_idle_chars" default="3.5" />
28+
<xacro:arg name="tool_device_name" default="/tmp/ttyUR" />
29+
<xacro:arg name="tool_tcp_port" default="54321" />
2130

2231
<!-- Simulation parameters -->
2332
<xacro:arg name="use_fake_hardware" default="false" />
@@ -54,7 +63,15 @@
5463
sim_ignition="$(arg sim_ignition)"
5564
headless_mode="$(arg headless_mode)"
5665
initial_positions="${load_yaml(initial_positions_file)}"
57-
use_tool_communication="$(arg use_tool_communication)" >
66+
use_tool_communication="$(arg use_tool_communication)"
67+
tool_voltage="$(arg tool_voltage)"
68+
tool_parity="$(arg tool_parity)"
69+
tool_baud_rate="$(arg tool_baud_rate)"
70+
tool_stop_bits="$(arg tool_stop_bits)"
71+
tool_rx_idle_chars="$(arg tool_rx_idle_chars)"
72+
tool_tx_idle_chars="$(arg tool_tx_idle_chars)"
73+
tool_device_name="$(arg tool_device_name)"
74+
tool_tcp_port="$(arg tool_tcp_port)" >
5875
<origin xyz="0 0 0" rpy="0 0 0" /> <!-- position robot in the world -->
5976
</xacro:ur_robot>
6077

urdf/ur_macro.xacro

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@
7272
sim_ignition:=false
7373
headless_mode:=false
7474
initial_positions:=${dict(shoulder_pan_joint=0.0,shoulder_lift_joint=-1.57,elbow_joint=0.0,wrist_1_joint=-1.57,wrist_2_joint=0.0,wrist_3_joint=0.0)}
75-
use_tool_communication:=false">
75+
use_tool_communication:=false
76+
tool_voltage:=24
77+
tool_parity:=0
78+
tool_baud_rate:=115200
79+
tool_stop_bits:=1
80+
tool_rx_idle_chars:=1.5
81+
tool_tx_idle_chars:=3.5
82+
tool_device_name:=/tmp/ttyUR
83+
tool_tcp_port:=54321" >
7684

7785
<!-- Load configuration data from the provided .yaml files -->
7886
<xacro:read_model_data
@@ -105,7 +113,15 @@
105113
tf_prefix=""
106114
hash_kinematics="${kinematics_hash}"
107115
robot_ip="$(arg robot_ip)"
108-
use_tool_communication="${use_tool_communication}"/>
116+
use_tool_communication="${use_tool_communication}"
117+
tool_voltage="${tool_voltage}"
118+
tool_parity="${tool_parity}"
119+
tool_baud_rate="${tool_baud_rate}"
120+
tool_stop_bits="${tool_stop_bits}"
121+
tool_rx_idle_chars="${tool_rx_idle_chars}"
122+
tool_tx_idle_chars="${tool_tx_idle_chars}"
123+
tool_device_name="${tool_device_name}"
124+
tool_tcp_port="${tool_tcp_port}"/>
109125

110126
<!-- Add URDF transmission elements (for ros_control) -->
111127
<!--<xacro:ur_arm_transmission prefix="${prefix}" hw_interface="${transmission_hw_interface}" />-->

0 commit comments

Comments
 (0)