Skip to content

Commit

Permalink
Use force, torque instead of angular/linear_wrench
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
  • Loading branch information
scpeters committed Aug 28, 2024
1 parent 3fa2308 commit 8521907
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 27 deletions.
8 changes: 4 additions & 4 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,8 @@ ABI was broken for `sdf::Element`, and restored on version 11.2.1.
+ `//link_state/angular_velocity`
+ `//link_state/linear_acceleration`
+ `//link_state/angular_acceleration`
+ `//link_state/linear_wrench`
+ `//link_state/angular_wrench`
+ `//link_state/force`
+ `//link_state/torque`

1. **model.sdf**:
+ `//model/model_state`
Expand Down Expand Up @@ -683,8 +683,8 @@ ABI was broken for `sdf::Element`, and restored on version 11.2.1.
and `//link_state/linear_velocity`.
+ `//link_state/acceleration` is deprecated in favor of `//link_state/angular_acceleration`
and `//link_state/linear_acceleration`.
+ `//link_state/wrench` is deprecated in favor of `//link_state/angular_wrench`
and `//link_state/linear_wrench`.
+ `//link_state/wrench` is deprecated in favor of `//link_state/torque`
and `//link_state/force`.

## SDFormat specification 1.10 to 1.11

Expand Down
9 changes: 4 additions & 5 deletions sdf/1.12/link_state.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@
</description>
</element>

<element name="angular_wrench" type="vector3" default="0 0 0" required="0">
<description>Angular wrench (torque) acting on the link relative to the world frame.
<element name="torque" type="vector3" default="0 0 0" required="0">
<description>Torque acting on the link relative to the world frame.
</description>
</element>

<element name="linear_wrench" type="vector3" default="0 0 0" required="0">
<element name="force" type="vector3" default="0 0 0" required="0">
<description>
Linear wrench (force) acting on the link at the link frame relative to
the world frame.
Force acting on the link at the link frame relative to the world frame.
</description>
</element>

Expand Down
36 changes: 18 additions & 18 deletions test/integration/nested_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ TEST(NestedModel, State)
<< " <angular_velocity>-0.1 5.0 -0.1</angular_velocity>"
<< " <linear_acceleration>0 0.006121 0</linear_acceleration>"
<< " <angular_acceleration>0.012288 0 0.001751</angular_acceleration>"
<< " <linear_wrench>0 0.006121 0</linear_wrench>"
<< " <angular_wrench>0 0 0</angular_wrench>"
<< " <force>0 0.006121 0</force>"
<< " <torque>0 0 0</torque>"
<< " </link_state>"
<< " <model_state name='model_01'>"
<< " <pose>1 0 0.5 0 0 0</pose>"
Expand All @@ -133,8 +133,8 @@ TEST(NestedModel, State)
<< " <angular_velocity>0 0 0</angular_velocity>"
<< " <linear_acceleration>0 0.000674 0</linear_acceleration>"
<< " <angular_acceleration>-0.001268 0 0</angular_acceleration>"
<< " <linear_wrench>0 0.000674 0</linear_wrench>"
<< " <angular_wrench>0 0 0</angular_wrench>"
<< " <force>0 0.000674 0</force>"
<< " <torque>0 0 0</torque>"
<< " </link_state>"
<< " <model_state name='model_02'>"
<< " <pose>1 1 0.5 0 0 0</pose>"
Expand All @@ -144,8 +144,8 @@ TEST(NestedModel, State)
<< " <angular_velocity>0 0 0</angular_velocity>"
<< " <linear_acceleration>0 0 0</linear_acceleration>"
<< " <angular_acceleration>0 0 0</angular_acceleration>"
<< " <linear_wrench>0 0 0</linear_wrench>"
<< " <angular_wrench>0 0 0</angular_wrench>"
<< " <force>0 0 0</force>"
<< " <torque>0 0 0</torque>"
<< " </link_state>"
<< " </model_state>"
<< " </model_state>"
Expand Down Expand Up @@ -199,11 +199,11 @@ TEST(NestedModel, State)
EXPECT_EQ(linkStateElem->Get<gz::math::Vector3d>("angular_acceleration"),
gz::math::Vector3d(0.012288, 0, 0.001751));
EXPECT_FALSE(linkStateElem->HasElement("wrench"));
EXPECT_TRUE(linkStateElem->HasElement("angular_wrench"));
EXPECT_TRUE(linkStateElem->HasElement("linear_wrench"));
EXPECT_EQ(linkStateElem->Get<gz::math::Vector3d>("linear_wrench"),
EXPECT_TRUE(linkStateElem->HasElement("torque"));
EXPECT_TRUE(linkStateElem->HasElement("force"));
EXPECT_EQ(linkStateElem->Get<gz::math::Vector3d>("force"),
gz::math::Vector3d(0, 0.006121, 0));
EXPECT_EQ(linkStateElem->Get<gz::math::Vector3d>("angular_wrench"),
EXPECT_EQ(linkStateElem->Get<gz::math::Vector3d>("torque"),
gz::math::Vector3d(0, 0, 0));

// nested model sdf
Expand Down Expand Up @@ -244,11 +244,11 @@ TEST(NestedModel, State)
nestedLinkStateElem->Get<gz::math::Vector3d>("angular_acceleration"),
gz::math::Vector3d(-0.001268, 0, 0));
EXPECT_FALSE(nestedLinkStateElem->HasElement("wrench"));
EXPECT_TRUE(nestedLinkStateElem->HasElement("angular_wrench"));
EXPECT_TRUE(nestedLinkStateElem->HasElement("linear_wrench"));
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("linear_wrench"),
EXPECT_TRUE(nestedLinkStateElem->HasElement("torque"));
EXPECT_TRUE(nestedLinkStateElem->HasElement("force"));
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("force"),
gz::math::Vector3d(0, 0.000674, 0));
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("angular_wrench"),
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("torque"),
gz::math::Vector3d(0, 0, 0));

// double nested model sdf
Expand Down Expand Up @@ -287,11 +287,11 @@ TEST(NestedModel, State)
nestedLinkStateElem->Get<gz::math::Vector3d>("angular_acceleration"),
gz::math::Vector3d(0, 0, 0));
EXPECT_FALSE(nestedLinkStateElem->HasElement("wrench"));
EXPECT_TRUE(nestedLinkStateElem->HasElement("angular_wrench"));
EXPECT_TRUE(nestedLinkStateElem->HasElement("linear_wrench"));
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("linear_wrench"),
EXPECT_TRUE(nestedLinkStateElem->HasElement("torque"));
EXPECT_TRUE(nestedLinkStateElem->HasElement("force"));
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("force"),
gz::math::Vector3d(0, 0, 0));
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("angular_wrench"),
EXPECT_EQ(nestedLinkStateElem->Get<gz::math::Vector3d>("torque"),
gz::math::Vector3d(0, 0, 0));
}

Expand Down

0 comments on commit 8521907

Please sign in to comment.