Skip to content

Commit

Permalink
Refactoring sr_description: adapted test and added more parameters va…
Browse files Browse the repository at this point in the history
…lidation (#124)

* Removing robots.old folder

* Lint fixes

* Fixing CMakeLists

* Removing whitespace

* Applying changes from ubi-agni#2

* Adapting tests to refactored sr_description

* Adding validation xacro

* Update process_hand_type_parameter.xacro

* Updated validation xacro and small fixes

* Update test_models.sh

* Fixed validation of parameters

* Fixing formtating and deleted unnecessary files

* Work in progress

* Removed unnecessary files

Co-authored-by: Beatriz Leon <beatriz@shadowrobot.com>
  • Loading branch information
maxzieba and Beatriz Leon authored Nov 11, 2021
1 parent 747a39a commit 822a5cf
Show file tree
Hide file tree
Showing 107 changed files with 161 additions and 1,843 deletions.
2 changes: 1 addition & 1 deletion sr_description/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ install(DIRECTORY loaders/
install(DIRECTORY robots/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/robots)

install(FILES materials.urdf.xacro
install(FILES other/xacro/materials.urdf.xacro
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
9 changes: 1 addition & 8 deletions sr_description/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ This package contains the description for Shadow Robot's Hands.

You can find the different complete models in [robots](robots).

You can also find more information about the computation of the [hand kinematics](doc/HandInertia.md).


*Tips: To automatically reformat the different xacro files you can use the following command:*

```bash
find . -name "*.urdf.xacro" -type f -exec tidy -xml -i -m -q "{}" \;
```
You can also find more information about the computation of the [hand kinematics](doc/HandInertia.md).
27 changes: 10 additions & 17 deletions sr_description/hand/xacro/finger/distal/distal.urdf.xacro
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">

<xacro:include filename="$(find sr_description)/hand/xacro/finger/distal/distal.gazebo.xacro" />
<xacro:include filename="$(find sr_description)/hand/xacro/finger/distal/distal.transmission.xacro" />
<!-- tip_sensor describes the sensor bt_2p, bt_sp, pst -->
<!-- prefix can be anything but usually is "r_" or "l_" for right and left hands distinction -->
<!-- link_prefix prepends fingername to the link names -->
<!-- joint_prefix prepends fingername to the joint names -->
<!-- parent is the parent link for the joint -->

<xacro:macro name="distal" params="prefix:=^ link_prefix:=^ joint_prefix:=^ tip_sensor:=^|pst parent">
<link name="${prefix}${link_prefix}distal">
<inertial>
<mass value="0.012" />
<origin xyz="0 0 0.012" />
<inertia ixx="0.00000094" ixy="0.0" ixz="0.0"
iyy="0.0000011" iyz="0.0" izz="0.00000053" />
<inertia ixx="0.00000094" ixy="0.0" ixz="0.0" iyy="0.0000011" iyz="0.0" izz="0.00000053" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
Expand Down Expand Up @@ -61,8 +56,7 @@ xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">
<origin xyz="0 0 0.025" rpy="0 0 0" />
<axis xyz="1 0 0" />
<!-- standard distal joint -->
<limit lower="0" upper="${pi/2}" effort="2"
velocity="2.0" />
<limit lower="0" upper="${pi/2}" effort="2" velocity="2.0" />
<dynamics damping="0.1" />
</joint>
<gazebo reference="${prefix}${joint_prefix}J1">
Expand All @@ -72,8 +66,7 @@ xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">
<link name="${prefix}${link_prefix}tip">
<inertial>
<mass value="0.001" />
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0"
iyz="0.0" izz="0.0" />
<inertia ixx="0.0" ixy="0.0" ixz="0.0" iyy="0.0" iyz="0.0" izz="0.0" />
</inertial>
</link>
<joint name="${prefix}${joint_prefix}tip" type="fixed">
Expand Down
15 changes: 1 addition & 14 deletions sr_description/hand/xacro/finger/knuckle/knuckle.gazebo.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,7 @@
<robot xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name="knuckle_gazebo" params="prefix:=^ link_prefix:=^">
<gazebo reference="${prefix}${link_prefix}knuckle">
<sensor type="contact" name="${prefix}${link_prefix}knuckle_contact">
<always_on>1</always_on>
<update_rate>1000.0</update_rate>
<contact>
<collision>${prefix}${link_prefix}knuckle_collision</collision>
<topic>${prefix}${link_prefix}knuckle_collision</topic>
</contact>
<plugin name="${prefix}${link_prefix}knuckle_gazebo_ros_bumper_controller" filename="libgazebo_ros_bumper.so">
<alwaysOn>true</alwaysOn>
<frameName>${prefix}${link_prefix}knuckle</frameName>
<updateRate>100.0</updateRate>
<bumperTopicName>contacts/${prefix}${link_prefix}/knuckle</bumperTopicName>
</plugin>
</sensor>
<!-- knuckle is not highly exposed, so bumper is not useful -->
<material>Gazebo/Grey</material>
</gazebo>
</xacro:macro>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">

<xacro:include filename="$(find sr_description)/hand/xacro/finger/lfmetacarpal/lfmetacarpal.gazebo.xacro" />
<xacro:include filename="$(find sr_description)/hand/xacro/finger/lfmetacarpal/lfmetacarpal.transmission.xacro" />
<!-- prefix can be anything but usually is "r_" or "l_" for right and left hands distinction -->
<!-- reflect is either 1 (for right hand) or -1 (for left hand) -->
<!-- parent is the parent link for the joint -->
<xacro:macro name="lfmetacarpal"
params="prefix:=^ reflect:=^ parent">

<xacro:macro name="lfmetacarpal" params="prefix:=^ reflect:=^ parent">
<link name="${prefix}lfmetacarpal">
<inertial>
<origin xyz="0 0 0.04" rpy="0 0 0" />
<mass value="0.030" />
<inertia ixx="0.0000145" ixy="0.0" ixz="0.0"
iyy="0.00001638" iyz="0.0" izz="0.000004272" />
<inertia ixx="0.0000145" ixy="0.0" ixz="0.0" iyy="0.00001638" iyz="0.0" izz="0.000004272" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
Expand All @@ -40,8 +36,7 @@ xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">
<child link="${prefix}lfmetacarpal" />
<origin xyz="${reflect*-0.033} 0 0.02071" rpy="0 0 0" />
<axis xyz="0.573576436 0 ${reflect*0.819152044}" />
<limit lower="0" upper="${45/180*pi}" effort="2"
velocity="2.0" />
<limit lower="0" upper="${45/180*pi}" effort="2" velocity="2.0" />
<dynamics damping="0.1" />
</joint>
<gazebo reference="${prefix}LFJ5">
Expand Down
12 changes: 6 additions & 6 deletions sr_description/hand/xacro/finger/proximal/proximal.urdf.xacro
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<robot xmlns:xacro="http://www.ros.org/wiki/xacro"
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">
xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#slider"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body"
xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom">

<xacro:include filename="$(find sr_description)/hand/xacro/finger/proximal/proximal.gazebo.xacro" />
<xacro:include filename="$(find sr_description)/hand/xacro/finger/proximal/proximal.transmission.xacro" />
Expand Down
3 changes: 1 addition & 2 deletions sr_description/hand/xacro/forearm/forearm_c.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
<inertial>
<origin xyz="0 0 0.09" rpy="0 0 0" />
<mass value="3.0" />
<inertia ixx="0.0138" ixy="0.0" ixz="0.0" iyy="0.0138"
iyz="0.0" izz="0.00744" />
<inertia ixx="0.0138" ixy="0.0" ixz="0.0" iyy="0.0138" iyz="0.0" izz="0.00744" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
Expand Down
3 changes: 1 addition & 2 deletions sr_description/hand/xacro/forearm/forearm_e.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
<inertial>
<origin xyz="0 0 0.09" rpy="0 0 0" />
<mass value="3.0" />
<inertia ixx="0.0138" ixy="0.0" ixz="0.0" iyy="0.0138"
iyz="0.0" izz="0.00744" />
<inertia ixx="0.0138" ixy="0.0" ixz="0.0" iyy="0.0138" iyz="0.0" izz="0.00744" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
Expand Down
12 changes: 7 additions & 5 deletions sr_description/hand/xacro/hand.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface">

<xacro:macro name="sr_hand"
params="hand_type hand_version side fingers tip_sensors prox_sensors mid_sensors palm_sensor">
<xacro:macro name="sr_hand" params="hand_type hand_version side fingers tip_sensors prox_sensors mid_sensors palm_sensor">

<!-- Process hand type, version and side parameters -->
<xacro:include filename="$(find sr_description)/hand/xacro/process_hand_type_version_side_parameters.xacro" />

<xacro:if value="${side == 'right'}">
<xacro:property name="reflect" value="1" />
Expand All @@ -16,15 +18,15 @@
</xacro:if>

<!-- Selecting hand according with hand_type -->
<xacro:if value="${hand_type == 'hand_e'}">
<xacro:if value="${hand_type == 'E'}">
<xacro:include filename="$(find sr_description)/hand/xacro/hand_e.urdf.xacro" />
<xacro:sr_hand_e />
</xacro:if>
<xacro:if value="${hand_type == 'hand_g'}">
<xacro:if value="${hand_type == 'G'}">
<xacro:include filename="$(find sr_description)/hand/xacro/hand_g.urdf.xacro" />
<xacro:sr_hand_g />
</xacro:if>
<xacro:if value="${hand_type == 'hand_c'}">
<xacro:if value="${hand_type == 'C'}">
<xacro:include filename="$(find sr_description)/hand/xacro/hand_c.urdf.xacro" />
<xacro:sr_hand_c />
</xacro:if>
Expand Down
6 changes: 1 addition & 5 deletions sr_description/hand/xacro/hand_c.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<xacro:include filename="$(find sr_description)/hand/xacro/finger/fingers.urdf.xacro" />
<xacro:include filename="$(find sr_description)/hand/xacro/thumb/thumb.urdf.xacro" />

<!-- hand_type can be: hand_e, hand_g, hand_c -->
<!-- fingers: list-like string specifying available fingers, default: 'th ff mf rf' -->
<!-- tip_sensors: plain or dict-like string specifying the fingertip (tactile) sensors: 'th=bt_2p ff=bt_sp mf=pst rf=pst, lf=pst' -->
<!-- mid_sensors: plain or dict-like string specifying the middle-phalange (tactile) sensors -->
Expand All @@ -14,10 +13,7 @@
<xacro:macro name="sr_hand_c" params="hand_version:=^ reflect:=^ prefix:=^ fingers:=^|all tip_sensors:=^|pst
prox_sensors:=^|none mid_sensors:=^|none palm_sensor:=^|none">

<!-- Unify hand type parameter -->
<xacro:property name="hand_type" value="hand_c" />
<xacro:include filename="$(find sr_description)/hand/xacro/process_hand_type_parameter.xacro" />
<!-- Process fingers parameter, also handling deprecated lf -->
<!-- Process fingers parameter -->
<xacro:property name="_all_finger_tokens_" value="${python.set('th ff mf rf lf'.split())}" />
<xacro:include filename="$(find sr_description)/hand/xacro/process_fingers_parameter.xacro" />
<!-- Process sensor parameters -->
Expand Down
6 changes: 1 addition & 5 deletions sr_description/hand/xacro/hand_e.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<xacro:include filename="$(find sr_description)/hand/xacro/finger/fingers.urdf.xacro" />
<xacro:include filename="$(find sr_description)/hand/xacro/thumb/thumb.urdf.xacro" />

<!-- hand_type can be: hand_e, hand_g, hand_c -->
<!-- fingers: list-like string specifying available fingers, default: 'th ff mf rf' -->
<!-- tip_sensors: plain or dict-like string specifying the fingertip (tactile) sensors: 'th=bt_2p ff=bt_sp mf=pst rf=pst, lf=pst' -->
<!-- mid_sensors: plain or dict-like string specifying the middle-phalange (tactile) sensors -->
Expand All @@ -18,10 +17,7 @@
<xacro:macro name="sr_hand_e" params="hand_version:=^ reflect:=^ prefix:=^ fingers:=^|all tip_sensors:=^|pst
prox_sensors:=^|none mid_sensors:=^|none palm_sensor:=^|none">

<!-- Unify hand type parameter -->
<xacro:property name="hand_type" value="hand_e" />
<xacro:include filename="$(find sr_description)/hand/xacro/process_hand_type_parameter.xacro" />
<!-- Process fingers parameter, also handling deprecated lf -->
<!-- Process fingers parameter -->
<xacro:property name="_all_finger_tokens_" value="${python.set('th ff mf rf lf'.split())}" />
<xacro:include filename="$(find sr_description)/hand/xacro/process_fingers_parameter.xacro" />
<!-- Process sensor parameters -->
Expand Down
6 changes: 1 addition & 5 deletions sr_description/hand/xacro/hand_g.urdf.xacro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<xacro:include filename="$(find sr_description)/hand/xacro/finger/fingers.urdf.xacro" />
<xacro:include filename="$(find sr_description)/hand/xacro/thumb/thumb.urdf.xacro" />

<!-- hand_type can be: hand_e, hand_g, hand_c -->
<!-- fingers: list-like string specifying available fingers, default: 'th ff mf rf' -->
<!-- tip_sensors: plain or dict-like string specifying the fingertip (tactile) sensors: 'th=bt_2p ff=bt_sp mf=pst rf=pst, lf=pst' -->
<!-- mid_sensors: plain or dict-like string specifying the middle-phalange (tactile) sensors -->
Expand All @@ -18,10 +17,7 @@
<xacro:macro name="sr_hand_g" params="hand_version:=^ reflect:=^ prefix:=^ fingers:=^|all tip_sensors:=^|pst
prox_sensors:=^|none mid_sensors:=^|none palm_sensor:=^|none">

<!-- Unify hand type parameter -->
<xacro:property name="hand_type" value="hand_g" />
<xacro:include filename="$(find sr_description)/hand/xacro/process_hand_type_parameter.xacro" />
<!-- Process fingers parameter, also handling deprecated -->
<!-- Process fingers parameter -->
<xacro:property name="_all_finger_tokens_" value="${python.set('th ff mf rf'.split())}" />
<xacro:include filename="$(find sr_description)/hand/xacro/process_fingers_parameter.xacro" />
<!-- Process sensor parameters -->
Expand Down
13 changes: 0 additions & 13 deletions sr_description/hand/xacro/legacy/ff_biotac_hand.urdf.xacro

This file was deleted.

17 changes: 0 additions & 17 deletions sr_description/hand/xacro/legacy/hand_E_no_mf_rf.urdf.xacro

This file was deleted.

Loading

0 comments on commit 822a5cf

Please sign in to comment.