Skip to content

Commit

Permalink
seems to be working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Katie Hughes committed Oct 30, 2024
1 parent be04d7d commit febcfc0
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
10 changes: 7 additions & 3 deletions spot_description/urdf/spot.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

<!-- General parameters -->
<xacro:arg name="arm" default="false" />
<xacro:arg name="gripperless" default="false" />
<xacro:arg name="feet" default="false" />
<xacro:arg name="tf_prefix" default="" />

<!-- Parameters used if Spot has an arm but not a gripper, or is outfitted with a custom gripper. -->
<xacro:arg name="gripperless" default="false" />
<xacro:arg name="custom_gripper_base_link" default="" />

<!-- Parameters for ROS 2 control -->
<xacro:arg name="add_ros2_control_tag" default="false" />
<xacro:arg name="hardware_interface_type" default="mock" />
Expand All @@ -24,9 +27,10 @@
<!-- Load Spot -->
<xacro:load_spot
arm="$(arg arm)"
gripperless="$(arg gripperless)"
feet="$(arg feet)"
tf_prefix="$(arg tf_prefix)" />
tf_prefix="$(arg tf_prefix)"
gripperless="$(arg gripperless)"
custom_gripper_base_link="$(arg custom_gripper_base_link)"/>

<!-- Adding the ROS 2 control tags -->
<xacro:if value="$(arg add_ros2_control_tag)">
Expand Down
24 changes: 19 additions & 5 deletions spot_description/urdf/spot_arm_macro.urdf
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0"?>
<robot name="spot_arm" xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="load_arm" params="
tf_prefix gripperless">
tf_prefix gripperless custom_gripper_base_link">

<!-- Useful boolean variable for determining if custom gripper base link should be used in the xacro -->
<xacro:property name="use_custom_gripper_base_link" value="${gripperless and custom_gripper_base_link!=''}"/>

<link name="${tf_prefix}arm_link_sh0">
<visual>
Expand Down Expand Up @@ -202,9 +205,11 @@
</joint>

<xacro:if value="${gripperless}">
<!-- This link needs to still be defined as to not break WR1 joint but can't include the meshes below, as these
includes parts of the gripper. -->
<link name="${tf_prefix}arm_link_wr1" />
<xacro:unless value="${use_custom_gripper_base_link}">
<!-- Here this link needs to still be defined as to not break WR1 joint but can't include the meshes below, as
these include parts of the gripper. Otherwise custom gripper base link will be used as the child of WR1 -->
<link name="${tf_prefix}arm_link_wr1" />
</xacro:unless>
</xacro:if>
<xacro:unless value="${gripperless}">
<link name="${tf_prefix}arm_link_wr1">
Expand Down Expand Up @@ -250,11 +255,20 @@
<origin xyz="0.0 0.0 0.0" rpy="0 0 0" />
<axis xyz="1 0 0" />
<parent link="${tf_prefix}arm_link_wr0" />
<child link="${tf_prefix}arm_link_wr1" />
<!-- Child link can be different depending on gripperless status: -->
<xacro:if value="${use_custom_gripper_base_link}">
<!-- can optionally be the custom link specified via arg -->
<child link="${custom_gripper_base_link}" />
</xacro:if>
<xacro:unless value="${use_custom_gripper_base_link}">
<!-- else defaults to normal arm_link_wr1 -->
<child link="${tf_prefix}arm_link_wr1" />
</xacro:unless>
<limit effort="30.3" velocity="10.0" lower="-2.87979326579064354163"
upper="2.87979326579064354163" />
</joint>

<!-- Finger joint and link shouldn't be included if gripperless -->
<xacro:unless value="${gripperless}">
<link name="${tf_prefix}arm_link_fngr">
<visual>
Expand Down
5 changes: 4 additions & 1 deletion spot_description/urdf/spot_macro.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
arm:=false
feet:=false
gripperless:=false
custom_gripper_base_link
tf_prefix">

<link name="${tf_prefix}body">
Expand Down Expand Up @@ -418,7 +419,9 @@
<!-- Include Arm if necessary-->
<xacro:if value="${arm}">
<xacro:include filename="$(find spot_description)/urdf/spot_arm_macro.urdf" />
<xacro:load_arm tf_prefix="${tf_prefix}" gripperless="${gripperless}" />
<xacro:load_arm tf_prefix="${tf_prefix}"
gripperless="${gripperless}"
custom_gripper_base_link="${custom_gripper_base_link}" />
</xacro:if>

<!-- Include links at feet if necessary -->
Expand Down

0 comments on commit febcfc0

Please sign in to comment.