|
| 1 | +<?xml version="1.0"?> |
| 2 | +<robot xmlns:xacro="http://www.ros.org/wiki/xacro"> |
| 3 | + |
| 4 | + <xacro:macro name="gripper_ros2_control" params=" |
| 5 | + prefix |
| 6 | + use_fake_hardware:=false |
| 7 | + fake_sensor_commands:=false |
| 8 | + sim_ignition:=false |
| 9 | + sim_isaac:=false |
| 10 | + isaac_joint_commands:=/isaac_joint_commands |
| 11 | + isaac_joint_states:=/isaac_joint_states |
| 12 | + use_internal_bus_gripper_comm:=false"> |
| 13 | + |
| 14 | + <ros2_control name="GripperHardwareInterface" type="system"> |
| 15 | + <hardware> |
| 16 | + <xacro:if value="${sim_isaac}"> |
| 17 | + <plugin>topic_based_ros2_control/TopicBasedSystem</plugin> |
| 18 | + <param name="joint_commands_topic">${isaac_joint_commands}</param> |
| 19 | + <param name="joint_states_topic">${isaac_joint_states}</param> |
| 20 | + <param name="trigger_joint_command_threshold">0.02</param> |
| 21 | + </xacro:if> |
| 22 | + <xacro:if value="${sim_ignition}"> |
| 23 | + <plugin>ign_ros2_control/IgnitionSystem</plugin> |
| 24 | + </xacro:if> |
| 25 | + <xacro:if value="${use_fake_hardware}"> |
| 26 | + <plugin>mock_components/GenericSystem</plugin> |
| 27 | + <param name="fake_sensor_commands">${fake_sensor_commands}</param> |
| 28 | + <param name="state_following_offset">0.0</param> |
| 29 | + </xacro:if> |
| 30 | + </hardware> |
| 31 | + |
| 32 | + <!-- Joint interfaces --> |
| 33 | + <!-- With Ignition or Hardware, they handle mimic joints, so we only need this command interface activated --> |
| 34 | + <joint name="${prefix}right_finger_bottom_joint"> |
| 35 | + <command_interface name="position" /> |
| 36 | + <state_interface name="position"> |
| 37 | + <param name="initial_value">0.85</param> |
| 38 | + </state_interface> |
| 39 | + <state_interface name="velocity"/> |
| 40 | + </joint> |
| 41 | + <!-- When simulating we need to include the rest of the gripper joints --> |
| 42 | + <xacro:if value="${use_fake_hardware or sim_isaac or sim_ignition}"> |
| 43 | + <joint name="${prefix}right_finger_tip_joint"> |
| 44 | + <param name="mimic">${prefix}right_finger_bottom_joint</param> |
| 45 | + <param name="multiplier">-1</param> |
| 46 | + <xacro:unless value="${sim_ignition}"> |
| 47 | + <command_interface name="position"/> |
| 48 | + <state_interface name="position"/> |
| 49 | + <state_interface name="velocity"/> |
| 50 | + </xacro:unless> |
| 51 | + </joint> |
| 52 | + <joint name="${prefix}left_finger_bottom_joint"> |
| 53 | + <param name="mimic">${prefix}right_finger_bottom_joint</param> |
| 54 | + <param name="multiplier">1</param> |
| 55 | + <xacro:unless value="${sim_ignition}"> |
| 56 | + <command_interface name="position"/> |
| 57 | + <state_interface name="position"/> |
| 58 | + <state_interface name="velocity"/> |
| 59 | + </xacro:unless> |
| 60 | + </joint> |
| 61 | + <joint name="${prefix}left_finger_tip_joint"> |
| 62 | + <param name="mimic">${prefix}right_finger_bottom_joint</param> |
| 63 | + <param name="multiplier">-1</param> |
| 64 | + <xacro:unless value="${sim_ignition}"> |
| 65 | + <command_interface name="position"/> |
| 66 | + <state_interface name="position"/> |
| 67 | + <state_interface name="velocity"/> |
| 68 | + </xacro:unless> |
| 69 | + </joint> |
| 70 | + </xacro:if> |
| 71 | + </ros2_control> |
| 72 | + </xacro:macro> |
| 73 | + |
| 74 | +</robot> |
0 commit comments