Skip to content

Commit

Permalink
sdformat: Update to libsdformat 9.0 (SDFormat 1.7) (RobotLocomotion#1…
Browse files Browse the repository at this point in the history
…2505)

This PR incorporates libsdformat 9.0, which supports the specification of
SDFormat 1.7.

Specifically, this incorporates pose frame semantics for SDFormat, which are
described in this proposal:
http://sdformat.org/tutorials?tut=pose_frame_semantics_proposal&cat=pose_semantics_docs
(source permalink: https://bit.ly/2ZSl1kH)

A brief summary of the changes from the proposal:
* Users may now specify poses relative to another frame using
`//pose/@relative_to`
  * Before, this was `//pose/@frame`, and was not described in the spec and
  only partially supported in Drake, but nowhere else.
  * Poses and frames within models cannot refer to the "world" frame.
* Users may now specify explicit frames, which will be exposed as
`MultibodyPlant` frames, and can be used within `//pose/@relative_to`.
  * Users can specify the attached-to fame using `//frame/@attached_to`.
  Before, this was specified using `//frame/pose/@frame`, and was only
  partially supported in Drake and nowhere else.
* All SDFormat models now have a canonical link, and all models have a model
frame attached to this canonical link.
  * For this reason, all models must have at least one link.
* `//joint/axis/xyz/@expressed_in` can be used to express an axis in a given
frame. `//joint/axis/use_parent_model_frame` has been removed in SDFormat 1.7,
but will be converted automatically from SDFormat 1.6 to 1.7.

(Note: The above paths are using XPath syntax.)
  • Loading branch information
EricCousineau-TRI authored Jan 3, 2020
1 parent f9e69b6 commit 3901c76
Show file tree
Hide file tree
Showing 13 changed files with 372 additions and 332 deletions.
5 changes: 4 additions & 1 deletion bindings/pydrake/test/parse_models_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def test_available_runfiles(self):
if model_relpath.startswith("external/sdformat/sdf"):
# These are schema files; do not load.
model_files.remove(model_file)
# Ensure that we have at least a certain number of models to check.
# We expect there to be dozens of files that should be available for
# parsing. Do a quick check to make sure we're in the right order of
# magnitude in order to prevent false test success based on changes
# that might lead to missing files.
self.assertGreater(len(model_files), 40)
# Parse each model file for testing.
for model_file in model_files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@
</link>

<frame name='top_center'>
<pose frame='world'>0 0 0.7645 0 -0 0</pose>
<!--
TODO(eric.cousineau): @frame='link' is redundant, but not having it
causes RBT SDFormat parsing code to segfault. Remove this once RBT is
removed.
-->
<pose frame='link'>0 0 0.7645 0 -0 0</pose>
</frame>

<!--
Expand Down
94 changes: 51 additions & 43 deletions manipulation/models/iiwa_description/sdf/iiwa14_no_collision.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
<!--
SDF automatically generated with: gz sdf -p /my_urdf.urdf > /my_sdf.sdf
Later edited by hand to rename the base link and remove damping from the joints.
Later edited by hand to:
* rename the base link
* remove damping from the joints
* use pose frame semantics to reflect URDF pose values.
-->
<sdf version='1.6'>
<sdf version='1.7'>
<model name='iiwa14'>
<link name='iiwa_link_0'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<inertial>
<pose frame=''>-0.1 0 0.07 0 -0 0</pose>
<pose>-0.1 0 0.07 0 -0 0</pose>
<mass>5</mass>
<inertia>
<ixx>0.05</ixx>
Expand All @@ -21,7 +24,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_0_fixed_joint_lump__iiwa_link_0_visual'>
<pose frame=''>0 0 0 0 0 0</pose>
<pose>0 0 0 0 0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -38,9 +41,9 @@ Later edited by hand to rename the base link and remove damping from the joints.
</link>

<link name='iiwa_link_1'>
<pose frame=''>0 0 0.1575 0 -0 0</pose>
<pose relative_to="iiwa_joint_1">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0 -0.03 0.12 0 -0 0</pose>
<pose>0 -0.03 0.12 0 -0 0</pose>
<mass>5.76</mass>
<inertia>
<ixx>0.033</ixx>
Expand All @@ -52,7 +55,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_1_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -68,6 +71,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_1' type='revolute'>
<pose relative_to="iiwa_link_0">0 0 0.1575 0 0 0</pose>
<child>iiwa_link_1</child>
<parent>iiwa_link_0</parent>
<axis>
Expand All @@ -84,13 +88,13 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<!-- SDFormat 1.7 -->
<link name='iiwa_link_2'>
<pose frame=''>0 0 0.36 1.5708 -0 -3.14159</pose>
<pose relative_to="iiwa_joint_2">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0.0003 0.059 0.042 0 -0 0</pose>
<pose>0.0003 0.059 0.042 0 -0 0</pose>
<mass>6.35</mass>
<inertia>
<ixx>0.0305</ixx>
Expand All @@ -102,7 +106,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_2_visual_grey'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -114,7 +118,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_2_visual_orange'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -130,10 +134,13 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_2' type='revolute'>
<pose relative_to="iiwa_link_1">
0 0 0.2025 1.570796326794897 0 3.141592653589793
</pose>
<child>iiwa_link_2</child>
<parent>iiwa_link_1</parent>
<axis>
<xyz>-0 1 0</xyz>
<xyz>0 0 1</xyz>
<limit>
<lower>-2.0944</lower>
<upper>2.0944</upper>
Expand All @@ -146,13 +153,12 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='iiwa_link_3'>
<pose frame=''>0 -0 0.5645 0 0 0</pose>
<pose relative_to="iiwa_joint_3">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0 0.03 0.13 0 -0 0</pose>
<pose>0 0.03 0.13 0 -0 0</pose>
<mass>3.5</mass>
<inertia>
<ixx>0.025</ixx>
Expand All @@ -164,7 +170,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_3_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -176,7 +182,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_3_visual_band'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -188,7 +194,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_3_visual_kuka'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -204,6 +210,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_3' type='revolute'>
<pose relative_to="iiwa_link_2">0 0.2045 0 1.570796326794897 0 3.141592653589793</pose>
<child>iiwa_link_3</child>
<parent>iiwa_link_2</parent>
<axis>
Expand All @@ -220,13 +227,12 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='iiwa_link_4'>
<pose frame=''>0 -0 0.78 1.5708 0 0</pose>
<pose relative_to="iiwa_joint_4">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0 0.067 0.034 0 -0 0</pose>
<pose>0 0.067 0.034 0 -0 0</pose>
<mass>3.5</mass>
<inertia>
<ixx>0.017</ixx>
Expand All @@ -238,7 +244,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_4_visual_grey'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -250,7 +256,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_4_visual_orange'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -266,10 +272,11 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_4' type='revolute'>
<pose relative_to="iiwa_link_3">0 0 0.2155 1.570796326794897 0 0</pose>
<child>iiwa_link_4</child>
<parent>iiwa_link_3</parent>
<axis>
<xyz>0 -1 0</xyz>
<xyz>0 0 1</xyz>
<limit>
<lower>-2.0944</lower>
<upper>2.0944</upper>
Expand All @@ -282,13 +289,12 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='iiwa_link_5'>
<pose frame=''>0 -0 0.9645 0 -0 -3.14159</pose>
<pose relative_to="iiwa_joint_5">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0.0001 0.021 0.076 0 -0 0</pose>
<pose>0.0001 0.021 0.076 0 -0 0</pose>
<mass>3.5</mass>
<inertia>
<ixx>0.01</ixx>
Expand All @@ -300,7 +306,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_5_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -312,7 +318,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_5_visual_band'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -324,7 +330,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_5_visual_kuka'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -340,6 +346,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_5' type='revolute'>
<pose relative_to="iiwa_link_4">0 0.1845 0 -1.570796326794897 3.141592653589793 0</pose>
<child>iiwa_link_5</child>
<parent>iiwa_link_4</parent>
<axis>
Expand All @@ -356,13 +363,12 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='iiwa_link_6'>
<pose frame=''>0 0 1.18 1.5708 -0 -3.14159</pose>
<pose relative_to="iiwa_joint_6">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0 0.0006 0.0004 0 -0 0</pose>
<pose>0 0.0006 0.0004 0 -0 0</pose>
<mass>1.8</mass>
<inertia>
<ixx>0.0049</ixx>
Expand All @@ -374,7 +380,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_6_visual_grey'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -386,7 +392,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</material>
</visual>
<visual name='iiwa_link_6_visual_orange'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -402,10 +408,11 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_6' type='revolute'>
<pose relative_to="iiwa_link_5">0 0 0.2155 1.570796326794897 0 0</pose>
<child>iiwa_link_6</child>
<parent>iiwa_link_5</parent>
<axis>
<xyz>-0 1 -0</xyz>
<xyz>0 0 1</xyz>
<limit>
<lower>-2.0944</lower>
<upper>2.0944</upper>
Expand All @@ -418,13 +425,12 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<link name='iiwa_link_7'>
<pose frame=''>0 0 1.261 0 0 0</pose>
<pose relative_to="iiwa_joint_7">0 0 0 0 0 0</pose>
<inertial>
<pose frame=''>0 0 0.02 0 -0 0</pose>
<pose>0 0 0.02 0 -0 0</pose>
<mass>1.2</mass>
<inertia>
<ixx>0.001</ixx>
Expand All @@ -436,7 +442,7 @@ Later edited by hand to rename the base link and remove damping from the joints.
</inertia>
</inertial>
<visual name='iiwa_link_7_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<pose>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
Expand All @@ -452,6 +458,9 @@ Later edited by hand to rename the base link and remove damping from the joints.
<self_collide>0</self_collide>
</link>
<joint name='iiwa_joint_7' type='revolute'>
<pose relative_to="iiwa_link_6">
0 0.081 0 -1.570796326794897 3.141592653589793 0
</pose>
<child>iiwa_link_7</child>
<parent>iiwa_link_6</parent>
<axis>
Expand All @@ -468,7 +477,6 @@ Later edited by hand to rename the base link and remove damping from the joints.
<spring_reference>0</spring_reference>
<spring_stiffness>0</spring_stiffness>
</dynamics>
<use_parent_model_frame>1</use_parent_model_frame>
</axis>
</joint>
<static>0</static>
Expand Down
6 changes: 4 additions & 2 deletions multibody/inverse_kinematics/test/position_constraint_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ TEST_F(IiwaKinematicConstraintTest, PositionConstraint) {
dq(i, 1) = std::sin(i + 0.2);
}
/* tolerance for checking numerical gradient vs analytical gradient. The
* numerical gradient is only accurate up to 2E-7 */
const double gradient_tol = 2E-7;
* numerical gradient is only accurate up to 4E-7 */
// N.B. Using libsdformat9 with pose frame semantics requires an increase in
// tolerance from 2E-7 to 4E-7.
const double gradient_tol = 4E-7;
TestKinematicConstraintEval(constraint, constraint_from_autodiff, q, dq,
gradient_tol);
}
Expand Down
Loading

0 comments on commit 3901c76

Please sign in to comment.