|
1 | 1 | <?xml version="1.0"?>
|
2 | 2 | <robot xmlns:xacro="http://www.ros.org/wiki/xacro">
|
3 | 3 |
|
4 |
| - <xacro:macro name="robotiq_gripper_ros2_control" params="name com_port"> |
5 |
| - <ros2_control name="${name}" type="actuator"> |
| 4 | + <xacro:macro name="robotiq_gripper_ros2_control" params=" |
| 5 | + name |
| 6 | + prefix |
| 7 | + sim_ignition:=false |
| 8 | + sim_isaac:=false |
| 9 | + use_fake_hardware:=false |
| 10 | + fake_sensor_commands:=false |
| 11 | + com_port:=/dev/ttyUSB0"> |
| 12 | + |
| 13 | + <ros2_control name="${name}" type="system"> |
| 14 | + <!-- Plugins --> |
6 | 15 | <hardware>
|
7 |
| - <plugin>robotiq_driver/RobotiqGripperHardwareInterface</plugin> |
8 |
| - <param name="gripper_closed_position">0.7929</param> |
9 |
| - <param name="COM_port">${com_port}</param> |
10 |
| - <param name="gripper_speed_multiplier">1.0</param> |
11 |
| - <param name="gripper_force_multiplier">0.5</param> |
| 16 | + <xacro:if value="${sim_isaac}"> |
| 17 | + <plugin>isaac_ros2_control/IsaacSystem</plugin> |
| 18 | + <param name="joint_commands_topic">/isaac_joint_commands</param> |
| 19 | + <param name="joint_states_topic">/isaac_joint_states</param> |
| 20 | + </xacro:if> |
| 21 | + <xacro:if value="${sim_ignition}"> |
| 22 | + <plugin>ign_ros2_control/IgnitionSystem</plugin> |
| 23 | + </xacro:if> |
| 24 | + <xacro:if value="${use_fake_hardware}"> |
| 25 | + <plugin>mock_components/GenericSystem</plugin> |
| 26 | + <param name="fake_sensor_commands">${fake_sensor_commands}</param> |
| 27 | + <param name="state_following_offset">0.0</param> |
| 28 | + </xacro:if> |
| 29 | + <xacro:unless value="${use_fake_hardware or sim_ignition or sim_isaac}"> |
| 30 | + <plugin>robotiq_driver/RobotiqGripperHardwareInterface</plugin> |
| 31 | + <param name="gripper_closed_position">0.7929</param> |
| 32 | + <param name="COM_port">${com_port}</param> |
| 33 | + <param name="gripper_speed_multiplier">1.0</param> |
| 34 | + <param name="gripper_force_multiplier">0.5</param> |
| 35 | + </xacro:unless> |
12 | 36 | </hardware>
|
13 |
| - <joint name="robotiq_85_left_knuckle_joint"> |
14 |
| - <param name="initial_position">0.7929</param> |
| 37 | + |
| 38 | + <!-- Joint interfaces --> |
| 39 | + <!-- With Ignition or Hardware, they handle mimic joints, so we only need this command interface activated --> |
| 40 | + <joint name="${prefix}robotiq_85_left_knuckle_joint"> |
15 | 41 | <command_interface name="position" />
|
16 |
| - <state_interface name="position" /> |
17 |
| - <state_interface name="velocity" /> |
| 42 | + <state_interface name="position"> |
| 43 | + <param name="initial_value">0.7929</param> |
| 44 | + </state_interface> |
| 45 | + <state_interface name="velocity"/> |
18 | 46 | </joint>
|
| 47 | + <!-- When simulating we need to include the rest of the gripper joints --> |
| 48 | + <xacro:if value="${use_fake_hardware or sim_isaac or sim_ignition}"> |
| 49 | + <joint name="${prefix}robotiq_85_right_knuckle_joint"> |
| 50 | + <param name="mimic">robotiq_85_left_knuckle_joint</param> |
| 51 | + <param name="multiplier">-1</param> |
| 52 | + <xacro:unless value="${sim_ignition}"> |
| 53 | + <command_interface name="position"/> |
| 54 | + <state_interface name="position"/> |
| 55 | + <state_interface name="velocity"/> |
| 56 | + </xacro:unless> |
| 57 | + </joint> |
| 58 | + <joint name="${prefix}robotiq_85_left_inner_knuckle_joint"> |
| 59 | + <param name="mimic">robotiq_85_left_knuckle_joint</param> |
| 60 | + <param name="multiplier">1</param> |
| 61 | + <xacro:unless value="${sim_ignition}"> |
| 62 | + <command_interface name="position"/> |
| 63 | + <state_interface name="position"/> |
| 64 | + <state_interface name="velocity"/> |
| 65 | + </xacro:unless> |
| 66 | + </joint> |
| 67 | + <joint name="${prefix}robotiq_85_right_inner_knuckle_joint"> |
| 68 | + <param name="mimic">robotiq_85_left_knuckle_joint</param> |
| 69 | + <param name="multiplier">-1</param> |
| 70 | + <xacro:unless value="${sim_ignition}"> |
| 71 | + <command_interface name="position"/> |
| 72 | + <state_interface name="position"/> |
| 73 | + <state_interface name="velocity"/> |
| 74 | + </xacro:unless> |
| 75 | + </joint> |
| 76 | + <joint name="${prefix}robotiq_85_left_finger_tip_joint"> |
| 77 | + <param name="mimic">robotiq_85_left_knuckle_joint</param> |
| 78 | + <param name="multiplier">-1</param> |
| 79 | + <xacro:unless value="${sim_ignition}"> |
| 80 | + <command_interface name="position"/> |
| 81 | + <state_interface name="position"/> |
| 82 | + <state_interface name="velocity"/> |
| 83 | + </xacro:unless> |
| 84 | + </joint> |
| 85 | + <joint name="${prefix}robotiq_85_right_finger_tip_joint"> |
| 86 | + <param name="mimic">robotiq_85_left_knuckle_joint</param> |
| 87 | + <param name="multiplier">1</param> |
| 88 | + <xacro:unless value="${sim_ignition}"> |
| 89 | + <command_interface name="position"/> |
| 90 | + <state_interface name="position"/> |
| 91 | + <state_interface name="velocity"/> |
| 92 | + </xacro:unless> |
| 93 | + </joint> |
| 94 | + </xacro:if> |
| 95 | + |
| 96 | + <!-- Only add this with fake hardware mode --> |
| 97 | + <xacro:unless value="${sim_ignition or sim_isaac}"> |
| 98 | + <gpio name="reactivate_gripper"> |
| 99 | + <command_interface name="reactivate_gripper_cmd" /> |
| 100 | + <command_interface name="reactivate_gripper_response" /> |
| 101 | + </gpio> |
| 102 | + </xacro:unless> |
| 103 | + |
19 | 104 | </ros2_control>
|
20 | 105 | </xacro:macro>
|
21 | 106 |
|
|
0 commit comments