Skip to content

Commit

Permalink
Merged in deprecate_joint_initial_position (pull request #683)
Browse files Browse the repository at this point in the history
Deprecate //joint/axis/initial_position

Approved-by: Eric Cousineau <[email protected]>
Approved-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Apr 9, 2020
2 parents ad274cb + b430a5c commit 30a6692
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 9 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
1. Initial version of sdformat 1.8 specification.
* [Pull request 682](https://bitbucket.org/osrf/sdformat/pull-requests/682)

1. sdf 1.8: Deprecate //joint/axis/initial_position.
* [Pull request 683](https://bitbucket.org/osrf/sdformat/pull-requests/683)

## SDFormat 9.X

### SDFormat 9.X.X (202X-XX-XX)
Expand Down
6 changes: 6 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ but with improved human-readability..
+ Changed to `_fixed_joint_lump__` to avoid confusion with scoped names
+ [Pull request 245](https://bitbucket.org/osrf/sdformat/pull-request/245)

## SDF protocol 1.7 to 1.8

### Deprecations

1. **joint.sdf** `initial_position` element in `<joint><axis>` and `<joint><axis2>` is deprecated

## SDF protocol 1.6 to 1.7

### Additions
Expand Down
4 changes: 2 additions & 2 deletions include/sdf/JointAxis.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ namespace sdf
/// default value is zero (0.0).
/// \return The initial joint position.
/// \sa void SetInitialPosition(const double _pos)
public: double InitialPosition() const;
public: double InitialPosition() const SDF_DEPRECATED(10.0);

/// \brief Set the initial joint position for this joint axis.
/// \param[in] _pos The initial joint position.
/// \sa double InitialPosition() const
public: void SetInitialPosition(const double _pos);
public: void SetInitialPosition(const double _pos) SDF_DEPRECATED(10.0);

/// \brief Get the x,y,z components of the axis unit vector.
/// The axis is expressed in the joint frame unless UseParentModelFrame
Expand Down
8 changes: 4 additions & 4 deletions sdf/1.8/joint.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
Parameters related to the axis of rotation for revolute joints,
the axis of translation for prismatic joints.
</description>
<element name="initial_position" type="double" default="0" required="0">
<element name="initial_position" type="double" default="0" required="-1">
<description>
Default joint position for this joint axis.
(DEPRECATION WARNING: This tag has no known implementation. It is deprecated SDFormat 1.8 and will be removed in SDFormat 1.9) Default joint position for this joint axis.
</description>
</element>
<element name="xyz" type="vector3" default="0 0 1" required="1">
Expand Down Expand Up @@ -107,9 +107,9 @@
<description>
Parameters related to the second axis of rotation for revolute2 joints and universal joints.
</description>
<element name="initial_position" type="double" default="0" required="0">
<element name="initial_position" type="double" default="0" required="-1">
<description>
Default joint position for this joint axis.
(DEPRECATION WARNING: This tag has no known implementation. It is deprecated SDFormat 1.8 and will be removed in SDFormat 1.9) Default joint position for this joint axis.
</description>
</element>
<element name="xyz" type="vector3" default="0 0 1" required="1">
Expand Down
4 changes: 4 additions & 0 deletions src/JointAxis_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ TEST(DOMJointAxis, Construction)
{
sdf::JointAxis axis;
EXPECT_EQ(nullptr, axis.Element());
SDF_SUPPRESS_DEPRECATED_BEGIN
EXPECT_DOUBLE_EQ(0.0, axis.InitialPosition());
SDF_SUPPRESS_DEPRECATED_END
EXPECT_EQ(ignition::math::Vector3d::UnitZ, axis.Xyz());
EXPECT_TRUE(axis.XyzExpressedIn().empty());
EXPECT_DOUBLE_EQ(0.0, axis.Damping());
Expand All @@ -37,8 +39,10 @@ TEST(DOMJointAxis, Construction)
EXPECT_DOUBLE_EQ(1e8, axis.Stiffness());
EXPECT_DOUBLE_EQ(1.0, axis.Dissipation());

SDF_SUPPRESS_DEPRECATED_BEGIN
axis.SetInitialPosition(1.2);
EXPECT_DOUBLE_EQ(1.2, axis.InitialPosition());
SDF_SUPPRESS_DEPRECATED_END

axis.SetXyz(ignition::math::Vector3d(0, 1, 0));
EXPECT_EQ(ignition::math::Vector3d::UnitY, axis.Xyz());
Expand Down
4 changes: 1 addition & 3 deletions src/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -790,9 +790,7 @@ bool readXml(TiXmlElement *_xml, ElementPtr _sdf, Errors &_errors)
// Check if the element pointer is deprecated.
if (_sdf->GetRequired() == "-1")
{
_errors.push_back({ErrorCode::ELEMENT_DEPRECATED,
"SDF Element[" + _sdf->GetName() + "] is deprecated"});
return true;
sdfwarn << "SDF Element[" + _sdf->GetName() + "] is deprecated\n";
}

if (!_xml)
Expand Down
5 changes: 5 additions & 0 deletions test/integration/joint_axis_dom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ TEST(DOMJointAxis, Complete)
EXPECT_EQ("__model__", axis->XyzExpressedIn());
EXPECT_TRUE(axis2->XyzExpressedIn().empty());

SDF_SUPPRESS_DEPRECATED_BEGIN
EXPECT_DOUBLE_EQ(0.5, axis->InitialPosition());
EXPECT_DOUBLE_EQ(1.5, axis2->InitialPosition());
SDF_SUPPRESS_DEPRECATED_END

EXPECT_DOUBLE_EQ(-0.5, axis->Lower());
EXPECT_DOUBLE_EQ(0.5, axis->Upper());
EXPECT_DOUBLE_EQ(-1.0, axis2->Lower());
Expand Down
2 changes: 2 additions & 0 deletions test/sdf/joint_complete.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<parent>link2</parent>
<axis>
<xyz>0 0 1</xyz>
<initial_position>0.5</initial_position>
<use_parent_model_frame>true</use_parent_model_frame>
<limit>
<lower>-0.5</lower>
Expand All @@ -44,6 +45,7 @@
</axis>
<axis2>
<xyz>0 1 0</xyz>
<initial_position>1.5</initial_position>
<use_parent_model_frame>false</use_parent_model_frame>
<limit>
<lower>-1</lower>
Expand Down

0 comments on commit 30a6692

Please sign in to comment.