Skip to content

Commit d11dbb8

Browse files
Support custom ROS2 system_interfaces
By setting the `use_custom_simulator` parameter, users can specify their own `ros2_control` and `hardware` tags inside their robot description. This allows users to implement their own simulators with custom `system_interfaces`.
1 parent a584902 commit d11dbb8

File tree

2 files changed

+38
-29
lines changed

2 files changed

+38
-29
lines changed

urdf/ur.urdf.xacro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
<!-- Simulation parameters -->
4040
<xacro:arg name="use_fake_hardware" default="false" />
41+
<xacro:arg name="use_custom_simulator" default="false" />
4142
<xacro:arg name="fake_sensor_commands" default="false" />
4243
<xacro:arg name="sim_gazebo" default="false" />
4344
<xacro:arg name="sim_ignition" default="false" />
@@ -66,6 +67,7 @@
6667
safety_pos_margin="$(arg safety_pos_margin)"
6768
safety_k_position="$(arg safety_k_position)"
6869
use_fake_hardware="$(arg use_fake_hardware)"
70+
use_custom_simulator="$(arg use_custom_simulator)"
6971
fake_sensor_commands="$(arg fake_sensor_commands)"
7072
sim_gazebo="$(arg sim_gazebo)"
7173
sim_ignition="$(arg sim_ignition)"

urdf/ur_macro.xacro

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
safety_pos_margin:=0.15
6868
safety_k_position:=20
6969
use_fake_hardware:=false
70+
use_custom_simulator:=false
7071
fake_sensor_commands:=false
7172
sim_gazebo:=false
7273
sim_ignition:=false
@@ -97,35 +98,41 @@
9798
force_abs_paths="${sim_gazebo or sim_ignition}"/>
9899

99100

100-
<!-- ros2 control include -->
101-
<xacro:include filename="$(find ur_description)/urdf/ur.ros2_control.xacro" />
102-
<!-- ros2 control instance -->
103-
<xacro:ur_ros2_control
104-
name="${name}" prefix="${prefix}"
105-
use_fake_hardware="${use_fake_hardware}"
106-
initial_positions="${initial_positions}"
107-
fake_sensor_commands="${fake_sensor_commands}"
108-
headless_mode="${headless_mode}"
109-
sim_gazebo="${sim_gazebo}"
110-
sim_ignition="${sim_ignition}"
111-
script_filename="${script_filename}"
112-
output_recipe_filename="${output_recipe_filename}"
113-
input_recipe_filename="${input_recipe_filename}"
114-
tf_prefix=""
115-
hash_kinematics="${kinematics_hash}"
116-
robot_ip="${robot_ip}"
117-
use_tool_communication="${use_tool_communication}"
118-
tool_voltage="${tool_voltage}"
119-
tool_parity="${tool_parity}"
120-
tool_baud_rate="${tool_baud_rate}"
121-
tool_stop_bits="${tool_stop_bits}"
122-
tool_rx_idle_chars="${tool_rx_idle_chars}"
123-
tool_tx_idle_chars="${tool_tx_idle_chars}"
124-
tool_device_name="${tool_device_name}"
125-
tool_tcp_port="${tool_tcp_port}"
126-
reverse_port="${reverse_port}"
127-
script_sender_port="${script_sender_port}"
128-
/>
101+
<!-- Support custom simulators.
102+
Users can specify their ros2_control and hardware tags inside their own robot description.
103+
This allows them to implement their own system_interface. -->
104+
<xacro:unless value="${use_custom_simulator}">
105+
<!-- ros2 control include -->
106+
<xacro:include filename="$(find ur_description)/urdf/ur.ros2_control.xacro" />
107+
<!-- ros2 control instance -->
108+
<xacro:ur_ros2_control
109+
name="${name}" prefix="${prefix}"
110+
use_fake_hardware="${use_fake_hardware}"
111+
use_custom_simulator="${use_custom_simulator}"
112+
initial_positions="${initial_positions}"
113+
fake_sensor_commands="${fake_sensor_commands}"
114+
headless_mode="${headless_mode}"
115+
sim_gazebo="${sim_gazebo}"
116+
sim_ignition="${sim_ignition}"
117+
script_filename="${script_filename}"
118+
output_recipe_filename="${output_recipe_filename}"
119+
input_recipe_filename="${input_recipe_filename}"
120+
tf_prefix=""
121+
hash_kinematics="${kinematics_hash}"
122+
robot_ip="${robot_ip}"
123+
use_tool_communication="${use_tool_communication}"
124+
tool_voltage="${tool_voltage}"
125+
tool_parity="${tool_parity}"
126+
tool_baud_rate="${tool_baud_rate}"
127+
tool_stop_bits="${tool_stop_bits}"
128+
tool_rx_idle_chars="${tool_rx_idle_chars}"
129+
tool_tx_idle_chars="${tool_tx_idle_chars}"
130+
tool_device_name="${tool_device_name}"
131+
tool_tcp_port="${tool_tcp_port}"
132+
reverse_port="${reverse_port}"
133+
script_sender_port="${script_sender_port}"
134+
/>
135+
</xacro:unless>
129136

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

0 commit comments

Comments
 (0)