|
| 1 | +<?xml version="1.0"?> |
| 2 | +<robot xmlns:xacro="http://www.ros.org/wiki/xacro"> |
| 3 | + |
| 4 | + <xacro:include filename="$(find ur_description)/urdf/inc/ur_joint_control.xacro" /> |
| 5 | + <xacro:include filename="$(find ur_description)/urdf/inc/ur_sensors.xacro" /> |
| 6 | + |
| 7 | + <xacro:macro name="ur_ros2_control" params=" |
| 8 | + name |
| 9 | + tf_prefix |
| 10 | + kinematics_parameters_file |
| 11 | + robot_ip |
| 12 | + script_filename |
| 13 | + input_recipe_filename |
| 14 | + output_recipe_filename |
| 15 | + transmission_hw_interface:=hardware_interface/PositionJointInterface |
| 16 | + use_mock_hardware:=false mock_sensor_commands:=false |
| 17 | + headless_mode:=false |
| 18 | + 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)} |
| 19 | + use_tool_communication:=false |
| 20 | + tool_voltage:=0 tool_parity:=0 tool_baud_rate:=115200 tool_stop_bits:=1 |
| 21 | + tool_rx_idle_chars:=1.5 tool_tx_idle_chars:=3.5 tool_device_name:=/tmp/ttyUR tool_tcp_port:=54321 |
| 22 | + reverse_port:=50001 |
| 23 | + script_sender_port:=50002 |
| 24 | + reverse_ip:=0.0.0.0 |
| 25 | + script_command_port:=50004 |
| 26 | + trajectory_port:=50003 |
| 27 | + non_blocking_read:=true |
| 28 | + keep_alive_count:=2 |
| 29 | + "> |
| 30 | + |
| 31 | + <xacro:property name="config_kinematics_parameters" value="${xacro.load_yaml(kinematics_parameters_file)}"/> |
| 32 | + <xacro:property name="sec_kinematics" value="${config_kinematics_parameters['kinematics']}" /> |
| 33 | + <xacro:property name="kinematics_hash" value="${sec_kinematics['hash']}" scope="parent"/> |
| 34 | + |
| 35 | + <!-- Add URDF transmission elements (for ros_control) --> |
| 36 | + <!--<xacro:ur_arm_transmission prefix="${prefix}" hw_interface="${transmission_hw_interface}" />--> |
| 37 | + <!-- Placeholder for ros2_control transmission which don't yet exist --> |
| 38 | + |
| 39 | + <ros2_control name="${name}" type="system"> |
| 40 | + <hardware> |
| 41 | + <xacro:if value="${use_mock_hardware}"> |
| 42 | + <plugin>mock_components/GenericSystem</plugin> |
| 43 | + <param name="mock_sensor_commands">${mock_sensor_commands}</param> |
| 44 | + <param name="state_following_offset">0.0</param> |
| 45 | + </xacro:if> |
| 46 | + <xacro:unless value="${use_mock_hardware}"> |
| 47 | + <plugin>ur_robot_driver/URPositionHardwareInterface</plugin> |
| 48 | + <param name="robot_ip">${robot_ip}</param> |
| 49 | + <param name="script_filename">${script_filename}</param> |
| 50 | + <param name="output_recipe_filename">${output_recipe_filename}</param> |
| 51 | + <param name="input_recipe_filename">${input_recipe_filename}</param> |
| 52 | + <param name="headless_mode">${headless_mode}</param> |
| 53 | + <param name="reverse_port">${reverse_port}</param> |
| 54 | + <param name="script_sender_port">${script_sender_port}</param> |
| 55 | + <param name="reverse_ip">${reverse_ip}</param> |
| 56 | + <param name="script_command_port">${script_command_port}</param> |
| 57 | + <param name="trajectory_port">${trajectory_port}</param> |
| 58 | + <param name="tf_prefix">${tf_prefix}</param> |
| 59 | + <param name="non_blocking_read">${non_blocking_read}</param> |
| 60 | + <param name="servoj_gain">2000</param> |
| 61 | + <param name="servoj_lookahead_time">0.03</param> |
| 62 | + <param name="use_tool_communication">${use_tool_communication}</param> |
| 63 | + <param name="kinematics/hash">${kinematics_hash}</param> |
| 64 | + <param name="tool_voltage">${tool_voltage}</param> |
| 65 | + <param name="tool_parity">${tool_parity}</param> |
| 66 | + <param name="tool_baud_rate">${tool_baud_rate}</param> |
| 67 | + <param name="tool_stop_bits">${tool_stop_bits}</param> |
| 68 | + <param name="tool_rx_idle_chars">${tool_rx_idle_chars}</param> |
| 69 | + <param name="tool_tx_idle_chars">${tool_tx_idle_chars}</param> |
| 70 | + <param name="tool_device_name">${tool_device_name}</param> |
| 71 | + <param name="tool_tcp_port">${tool_tcp_port}</param> |
| 72 | + <param name="keep_alive_count">${keep_alive_count}</param> |
| 73 | + </xacro:unless> |
| 74 | + </hardware> |
| 75 | + |
| 76 | + <xacro:ur_joint_control_description |
| 77 | + tf_prefix="${tf_prefix}" |
| 78 | + initial_positions="${initial_positions}" |
| 79 | + /> |
| 80 | + |
| 81 | + <xacro:ur_sensors |
| 82 | + tf_prefix="${tf_prefix}" |
| 83 | + /> |
| 84 | + |
| 85 | + <!-- NOTE The following are joints used only for testing with mock hardware and will change in the future --> |
| 86 | + <gpio name="${tf_prefix}speed_scaling"> |
| 87 | + <state_interface name="speed_scaling_factor"/> |
| 88 | + <param name="initial_speed_scaling_factor">1</param> |
| 89 | + <command_interface name="target_speed_fraction_cmd"/> |
| 90 | + <command_interface name="target_speed_fraction_async_success"/> |
| 91 | + </gpio> |
| 92 | + |
| 93 | + <gpio name="${tf_prefix}gpio"> |
| 94 | + <command_interface name="standard_digital_output_cmd_0"/> |
| 95 | + <command_interface name="standard_digital_output_cmd_1"/> |
| 96 | + <command_interface name="standard_digital_output_cmd_2"/> |
| 97 | + <command_interface name="standard_digital_output_cmd_3"/> |
| 98 | + <command_interface name="standard_digital_output_cmd_4"/> |
| 99 | + <command_interface name="standard_digital_output_cmd_5"/> |
| 100 | + <command_interface name="standard_digital_output_cmd_6"/> |
| 101 | + <command_interface name="standard_digital_output_cmd_7"/> |
| 102 | + <command_interface name="standard_digital_output_cmd_8"/> |
| 103 | + <command_interface name="standard_digital_output_cmd_9"/> |
| 104 | + <command_interface name="standard_digital_output_cmd_10"/> |
| 105 | + <command_interface name="standard_digital_output_cmd_11"/> |
| 106 | + <command_interface name="standard_digital_output_cmd_12"/> |
| 107 | + <command_interface name="standard_digital_output_cmd_13"/> |
| 108 | + <command_interface name="standard_digital_output_cmd_14"/> |
| 109 | + <command_interface name="standard_digital_output_cmd_15"/> |
| 110 | + <command_interface name="standard_digital_output_cmd_16"/> |
| 111 | + <command_interface name="standard_digital_output_cmd_17"/> |
| 112 | + |
| 113 | + <command_interface name="standard_analog_output_cmd_0"/> |
| 114 | + <command_interface name="standard_analog_output_cmd_1"/> |
| 115 | + |
| 116 | + <command_interface name="tool_voltage_cmd"/> |
| 117 | + |
| 118 | + <command_interface name="io_async_success"/> |
| 119 | + |
| 120 | + <state_interface name="digital_output_0"/> |
| 121 | + <state_interface name="digital_output_1"/> |
| 122 | + <state_interface name="digital_output_2"/> |
| 123 | + <state_interface name="digital_output_3"/> |
| 124 | + <state_interface name="digital_output_4"/> |
| 125 | + <state_interface name="digital_output_5"/> |
| 126 | + <state_interface name="digital_output_6"/> |
| 127 | + <state_interface name="digital_output_7"/> |
| 128 | + <state_interface name="digital_output_8"/> |
| 129 | + <state_interface name="digital_output_9"/> |
| 130 | + <state_interface name="digital_output_10"/> |
| 131 | + <state_interface name="digital_output_11"/> |
| 132 | + <state_interface name="digital_output_12"/> |
| 133 | + <state_interface name="digital_output_13"/> |
| 134 | + <state_interface name="digital_output_14"/> |
| 135 | + <state_interface name="digital_output_15"/> |
| 136 | + <state_interface name="digital_output_16"/> |
| 137 | + <state_interface name="digital_output_17"/> |
| 138 | + |
| 139 | + <state_interface name="digital_input_0"/> |
| 140 | + <state_interface name="digital_input_1"/> |
| 141 | + <state_interface name="digital_input_2"/> |
| 142 | + <state_interface name="digital_input_3"/> |
| 143 | + <state_interface name="digital_input_4"/> |
| 144 | + <state_interface name="digital_input_5"/> |
| 145 | + <state_interface name="digital_input_6"/> |
| 146 | + <state_interface name="digital_input_7"/> |
| 147 | + <state_interface name="digital_input_8"/> |
| 148 | + <state_interface name="digital_input_9"/> |
| 149 | + <state_interface name="digital_input_10"/> |
| 150 | + <state_interface name="digital_input_11"/> |
| 151 | + <state_interface name="digital_input_12"/> |
| 152 | + <state_interface name="digital_input_13"/> |
| 153 | + <state_interface name="digital_input_14"/> |
| 154 | + <state_interface name="digital_input_15"/> |
| 155 | + <state_interface name="digital_input_16"/> |
| 156 | + <state_interface name="digital_input_17"/> |
| 157 | + |
| 158 | + <state_interface name="standard_analog_output_0"/> |
| 159 | + <state_interface name="standard_analog_output_1"/> |
| 160 | + |
| 161 | + <state_interface name="standard_analog_input_0"/> |
| 162 | + <state_interface name="standard_analog_input_1"/> |
| 163 | + |
| 164 | + <state_interface name="analog_io_type_0"/> |
| 165 | + <state_interface name="analog_io_type_1"/> |
| 166 | + <state_interface name="analog_io_type_2"/> |
| 167 | + <state_interface name="analog_io_type_3"/> |
| 168 | + |
| 169 | + <state_interface name="tool_mode"/> |
| 170 | + <state_interface name="tool_output_voltage"/> |
| 171 | + <state_interface name="tool_output_current"/> |
| 172 | + <state_interface name="tool_temperature"/> |
| 173 | + |
| 174 | + <state_interface name="tool_analog_input_0"/> |
| 175 | + <state_interface name="tool_analog_input_1"/> |
| 176 | + |
| 177 | + <state_interface name="tool_analog_input_type_0"/> |
| 178 | + <state_interface name="tool_analog_input_type_1"/> |
| 179 | + |
| 180 | + <state_interface name="robot_mode"/> |
| 181 | + <state_interface name="robot_status_bit_0"/> |
| 182 | + <state_interface name="robot_status_bit_1"/> |
| 183 | + <state_interface name="robot_status_bit_2"/> |
| 184 | + <state_interface name="robot_status_bit_3"/> |
| 185 | + |
| 186 | + <state_interface name="safety_mode"/> |
| 187 | + <state_interface name="safety_status_bit_0"/> |
| 188 | + <state_interface name="safety_status_bit_1"/> |
| 189 | + <state_interface name="safety_status_bit_2"/> |
| 190 | + <state_interface name="safety_status_bit_3"/> |
| 191 | + <state_interface name="safety_status_bit_4"/> |
| 192 | + <state_interface name="safety_status_bit_5"/> |
| 193 | + <state_interface name="safety_status_bit_6"/> |
| 194 | + <state_interface name="safety_status_bit_7"/> |
| 195 | + <state_interface name="safety_status_bit_8"/> |
| 196 | + <state_interface name="safety_status_bit_9"/> |
| 197 | + <state_interface name="safety_status_bit_10"/> |
| 198 | + |
| 199 | + <state_interface name="program_running"/> |
| 200 | + </gpio> |
| 201 | + |
| 202 | + <gpio name="${tf_prefix}payload"> |
| 203 | + <command_interface name="mass"/> |
| 204 | + <command_interface name="cog.x"/> |
| 205 | + <command_interface name="cog.y"/> |
| 206 | + <command_interface name="cog.z"/> |
| 207 | + <command_interface name="payload_async_success"/> |
| 208 | + </gpio> |
| 209 | + |
| 210 | + <gpio name="${tf_prefix}resend_robot_program"> |
| 211 | + <command_interface name="resend_robot_program_cmd"/> |
| 212 | + <command_interface name="resend_robot_program_async_success"/> |
| 213 | + </gpio> |
| 214 | + |
| 215 | + <gpio name="${tf_prefix}hand_back_control"> |
| 216 | + <command_interface name="hand_back_control_cmd"/> |
| 217 | + <command_interface name="hand_back_control_async_success"/> |
| 218 | + </gpio> |
| 219 | + |
| 220 | + <gpio name="${tf_prefix}zero_ftsensor"> |
| 221 | + <command_interface name="zero_ftsensor_cmd"/> |
| 222 | + <command_interface name="zero_ftsensor_async_success"/> |
| 223 | + </gpio> |
| 224 | + |
| 225 | + <gpio name="${tf_prefix}system_interface"> |
| 226 | + <state_interface name="initialized"/> |
| 227 | + </gpio> |
| 228 | + </ros2_control> |
| 229 | + </xacro:macro> |
| 230 | +</robot> |
0 commit comments