|
4 | 4 | <xacro:macro name="ur_ros2_control" params=" |
5 | 5 | name |
6 | 6 | prefix |
7 | | - use_fake_hardware:=false fake_sensor_commands:=false |
8 | | - sim_gazebo:=false |
9 | | - sim_ignition:=false |
10 | | - headless_mode:=false |
| 7 | + add_state_and_command_interfaces |
11 | 8 | 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)} |
12 | | - use_tool_communication:=false |
13 | | - script_filename output_recipe_filename |
14 | | - input_recipe_filename tf_prefix |
15 | | - hash_kinematics robot_ip |
16 | | - tool_voltage:=0 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 |
18 | | - reverse_port:=50001 |
19 | | - script_sender_port:=50002 |
20 | | - reverse_ip:=0.0.0.0 |
21 | | - script_command_port:=50004 |
22 | 9 | transmission_hw_interface:=hardware_interface/PositionJointInterface |
| 10 | + **hardware_system |
23 | 11 | "> |
24 | 12 |
|
25 | 13 | <!-- Add URDF transmission elements (for ros_control) --> |
26 | 14 | <!--<xacro:ur_arm_transmission prefix="${prefix}" hw_interface="${transmission_hw_interface}" />--> |
27 | 15 |
|
28 | 16 | <ros2_control name="${name}" type="system"> |
29 | | - <hardware> |
30 | | - <xacro:if value="${sim_gazebo}"> |
31 | | - <plugin>gazebo_ros2_control/GazeboSystem</plugin> |
32 | | - </xacro:if> |
33 | | - <xacro:if value="${sim_ignition}"> |
34 | | - <plugin>ign_ros2_control/IgnitionSystem</plugin> |
35 | | - </xacro:if> |
36 | | - <xacro:if value="${use_fake_hardware}"> |
37 | | - <plugin>mock_components/GenericSystem</plugin> |
38 | | - <param name="fake_sensor_commands">${fake_sensor_commands}</param> |
39 | | - <param name="state_following_offset">0.0</param> |
40 | | - </xacro:if> |
41 | | - <xacro:unless value="${use_fake_hardware or sim_gazebo or sim_ignition}"> |
42 | | - <plugin>ur_robot_driver/URPositionHardwareInterface</plugin> |
43 | | - <param name="robot_ip">${robot_ip}</param> |
44 | | - <param name="script_filename">${script_filename}</param> |
45 | | - <param name="output_recipe_filename">${output_recipe_filename}</param> |
46 | | - <param name="input_recipe_filename">${input_recipe_filename}</param> |
47 | | - <param name="headless_mode">${headless_mode}</param> |
48 | | - <param name="reverse_port">${reverse_port}</param> |
49 | | - <param name="script_sender_port">${script_sender_port}</param> |
50 | | - <param name="reverse_ip">${reverse_ip}</param> |
51 | | - <param name="script_command_port">${script_command_port}</param> |
52 | | - <param name="tf_prefix">"${tf_prefix}"</param> |
53 | | - <param name="non_blocking_read">0</param> |
54 | | - <param name="servoj_gain">2000</param> |
55 | | - <param name="servoj_lookahead_time">0.03</param> |
56 | | - <param name="use_tool_communication">${use_tool_communication}</param> |
57 | | - <param name="kinematics/hash">${hash_kinematics}</param> |
58 | | - <param name="tool_voltage">${tool_voltage}</param> |
59 | | - <param name="tool_parity">${tool_parity}</param> |
60 | | - <param name="tool_baud_rate">${tool_baud_rate}</param> |
61 | | - <param name="tool_stop_bits">${tool_stop_bits}</param> |
62 | | - <param name="tool_rx_idle_chars">${tool_rx_idle_chars}</param> |
63 | | - <param name="tool_tx_idle_chars">${tool_tx_idle_chars}</param> |
64 | | - <param name="tool_device_name">${tool_device_name}</param> |
65 | | - <param name="tool_tcp_port">${tool_tcp_port}</param> |
66 | | - </xacro:unless> |
67 | | - </hardware> |
| 17 | + <!-- Hardware dependency injection from outside the macro--> |
| 18 | + <xacro:insert_block name="hardware_system" /> |
| 19 | + <!-- --> |
68 | 20 | <joint name="${prefix}shoulder_pan_joint"> |
69 | 21 | <command_interface name="position"> |
70 | 22 | <param name="min">{-2*pi}</param> |
|
162 | 114 | <state_interface name="effort"/> |
163 | 115 | </joint> |
164 | 116 |
|
165 | | - <xacro:unless value="${sim_gazebo or sim_ignition}"> |
| 117 | + <xacro:unless value="${add_state_and_command_interfaces}"> |
166 | 118 | <sensor name="tcp_fts_sensor"> |
167 | 119 | <state_interface name="force.x"/> |
168 | 120 | <state_interface name="force.y"/> |
|
0 commit comments