Skip to content

Commit

Permalink
Merge c9c0d86 into 2d298f0
Browse files Browse the repository at this point in the history
  • Loading branch information
azeey authored Jul 15, 2021
2 parents 2d298f0 + c9c0d86 commit efe5ff1
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 172 deletions.
20 changes: 19 additions & 1 deletion Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,20 @@ one root level model, actor or light.

### Removals

1. **src/Root.hh**: The following deprecated methods have been removed.
The following deprecated methods and classes have been removed.

1. **sdf/Element.hh**
+ void SetInclude(const std::string);
+ std::string GetInclude() const;

1. **sdf/Types.hh**
+ sdf::Color class

1. **sdf/JointAxis.hh**
+ double InitialPosition() const;
+ void SetInitialPosition(const double)

1. **sdf/Root.hh**:
+ const sdf::Model \*ModelByIndex();
+ uint64_t ModelCount();
+ bool ModelNameExists(const std::string &\_name) const;
Expand Down Expand Up @@ -351,6 +364,11 @@ ABI was broken for `sdf::Element`, and restored on version 11.2.1.

## SDFormat specification 1.8 to 1.9

###Removals

1. **joint.sdf**
+ Deprecated elements `//joint/axis/initial_position` and `//joint/axis2/initial_position` have been removed

## SDFormat specification 1.7 to 1.8

### Additions
Expand Down
11 changes: 0 additions & 11 deletions include/sdf/Element.hh
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,6 @@ namespace sdf
/// embedded Param.
public: void Reset();

/// \brief Set the include filename to the passed in filename.
/// \param[in] _filename the filename to set the include filename to.
public: void SetInclude(const std::string &_filename) SDF_DEPRECATED(11.0);

/// \brief Get the include filename.
/// \return The include filename.
public: std::string GetInclude() const SDF_DEPRECATED(11.0);

/// \brief Set the <include> element that was used to load this element.
/// This is set by the parser on the first element of the included object
/// (eg. Model, Actor, Light, etc). It is not passed down to children
Expand Down Expand Up @@ -562,9 +554,6 @@ namespace sdf
/// this is when saving a loaded world back to SDFormat.
public: ElementPtr includeElement;

/// name of the include file that was used to create this element
public: std::string includeFilename;

/// \brief Name of reference sdf.
public: std::string referenceSDF;

Expand Down
11 changes: 0 additions & 11 deletions include/sdf/JointAxis.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,6 @@ namespace sdf
/// an error code and message. An empty vector indicates no error.
public: Errors Load(ElementPtr _sdf);

/// \brief Get the initial joint position for this joint axis. The
/// default value is zero (0.0).
/// \return The initial joint position.
/// \sa void SetInitialPosition(const double _pos)
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) SDF_DEPRECATED(10.0);

/// \brief Get the x,y,z components of the axis unit vector.
/// The axis is expressed in the frame named in XyzExpressedIn() and
/// defaults to the joint frame if that method returns an empty string.
Expand Down
60 changes: 0 additions & 60 deletions include/sdf/Types.hh
Original file line number Diff line number Diff line change
Expand Up @@ -112,66 +112,6 @@ namespace sdf
SDFORMAT_VISIBLE std::ostream &operator<<(
std::ostream &_out, const sdf::Errors &_errs);

/// \brief Defines a color
class SDFORMAT_VISIBLE Color
{
/// \brief Constructor
/// \param[in] _r Red value (range 0 to 1)
/// \param[in] _g Green value (range 0 to 1
/// \param[in] _b Blue value (range 0 to 1
/// \param[in] _a Alpha value (0=transparent, 1=opaque)
/// \deprecated Use ignition::math::Color
public: Color(float _r = 0.0f, float _g = 0.0f,
float _b = 0.0f, float _a = 1.0f) SDF_DEPRECATED(6.0)
: r(_r), g(_g), b(_b), a(_a)
{}

/// \brief Stream insertion operator
/// \param[in] _out the output stream
/// \param[in] _pt the color
/// \return the output stream
public: friend std::ostream &operator<< (std::ostream &_out,
const Color &_pt)
{
_out << _pt.r << " " << _pt.g << " " << _pt.b << " " << _pt.a;
return _out;
}

/// \brief Stream insertion operator
/// \param[in] _in the input stream
/// \param[in] _pt
public: friend std::istream &operator>> (std::istream &_in, Color &_pt)
{
// Skip white spaces
_in.setf(std::ios_base::skipws);
_in >> _pt.r >> _pt.g >> _pt.b >> _pt.a;
return _in;
}

/// \brief Equality operator
/// \param[in] _clr The color to check for equality
/// \return True if the this color equals _clf
public: bool operator ==(const Color &_clr) const
{
return equal(this->r, _clr.r) &&
equal(this->g, _clr.g) &&
equal(this->b, _clr.b) &&
equal(this->a, _clr.a);
}

/// \brief Red value
public: float r;

/// \brief Green value
public: float g;

/// \brief Blue value
public: float b;

/// \brief Alpha value
public: float a;
};

/// \brief A Time class, can be used to hold wall- or sim-time.
/// stored as sec and nano-sec.
class SDFORMAT_VISIBLE Time
Expand Down
9 changes: 9 additions & 0 deletions sdf/1.9/1_8.convert
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<convert name="sdf">

<!-- Remove //axis/initial_position and //axis2/initial_position -->
<convert descendant_name="joint">
<convert name="axis">
<remove element="initial_position"/>
</convert>
<convert name="axis2">
<remove element="initial_position"/>
</convert>
</convert>
</convert> <!-- End SDF -->
10 changes: 0 additions & 10 deletions sdf/1.9/joint.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
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="-1">
<description>
(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">
<description>
Represents the x,y,z components of the axis unit vector. The axis is
Expand Down Expand Up @@ -107,11 +102,6 @@
<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="-1">
<description>
(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">
<description>
Represents the x,y,z components of the axis unit vector. The axis is
Expand Down
24 changes: 1 addition & 23 deletions src/Element.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ ElementPtr Element::Clone() const
clone->dataPtr->name = this->dataPtr->name;
clone->dataPtr->required = this->dataPtr->required;
clone->dataPtr->copyChildren = this->dataPtr->copyChildren;
clone->dataPtr->includeFilename = this->dataPtr->includeFilename;
clone->dataPtr->referenceSDF = this->dataPtr->referenceSDF;
clone->dataPtr->path = this->dataPtr->path;
clone->dataPtr->lineNumber = this->dataPtr->lineNumber;
Expand Down Expand Up @@ -233,7 +232,6 @@ void Element::Copy(const ElementPtr _elem)
this->dataPtr->description = _elem->GetDescription();
this->dataPtr->required = _elem->GetRequired();
this->dataPtr->copyChildren = _elem->GetCopyChildren();
this->dataPtr->includeFilename = _elem->dataPtr->includeFilename;
this->dataPtr->referenceSDF = _elem->ReferenceSDF();
this->dataPtr->originalVersion = _elem->OriginalVersion();
this->dataPtr->path = _elem->FilePath();
Expand Down Expand Up @@ -552,15 +550,7 @@ std::string Element::ToString(const std::string &_prefix) const
void Element::ToString(const std::string &_prefix,
std::ostringstream &_out) const
{
if (this->dataPtr->includeFilename.empty())
{
PrintValuesImpl(_prefix, _out);
}
else
{
_out << _prefix << "<include filename='"
<< this->dataPtr->includeFilename << "'/>\n";
}
PrintValuesImpl(_prefix, _out);
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -966,18 +956,6 @@ void Element::AddElementDescription(ElementPtr _elem)
this->dataPtr->elementDescriptions.push_back(_elem);
}

/////////////////////////////////////////////////
void Element::SetInclude(const std::string &_filename)
{
this->dataPtr->includeFilename = _filename;
}

/////////////////////////////////////////////////
std::string Element::GetInclude() const
{
return this->dataPtr->includeFilename;
}

/////////////////////////////////////////////////
void Element::SetIncludeElement(sdf::ElementPtr _includeElem)
{
Expand Down
25 changes: 0 additions & 25 deletions src/Element_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -284,14 +284,6 @@ TEST(Element, Include)
{
sdf::Element elem;

SDF_SUPPRESS_DEPRECATED_BEGIN
ASSERT_EQ(elem.GetInclude(), "");

elem.SetInclude("foo.txt");

ASSERT_EQ(elem.GetInclude(), "foo.txt");
SDF_SUPPRESS_DEPRECATED_END

auto includeElemToStore = std::make_shared<sdf::Element>();
includeElemToStore->SetName("include");
auto uriDesc = std::make_shared<sdf::Element>();
Expand Down Expand Up @@ -602,23 +594,6 @@ TEST(Element, ToStringClonedElement)
EXPECT_EQ(parent->ToString("myprefix"), parentClone->ToString("myprefix"));
}

/////////////////////////////////////////////////
TEST(Element, ToStringInclude)
{
sdf::Element elem;

SDF_SUPPRESS_DEPRECATED_BEGIN
ASSERT_EQ(elem.GetInclude(), "");

elem.SetInclude("foo.txt");

ASSERT_EQ(elem.GetInclude(), "foo.txt");
SDF_SUPPRESS_DEPRECATED_END

std::string stringval = elem.ToString("myprefix");
ASSERT_EQ(stringval, "myprefix<include filename='foo.txt'/>\n");
}

/////////////////////////////////////////////////
TEST(Element, DocLeftPane)
{
Expand Down
18 changes: 0 additions & 18 deletions src/JointAxis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ using namespace sdf;

class sdf::JointAxis::Implementation
{
/// \brief Default joint position for this joint axis.
public: double initialPosition = 0.0;

/// \brief Represents the x,y,z components of the axis unit vector.
/// The axis is expressed in the joint frame unless the
/// use_parent_model_frame flag is set to true. The vector should be
Expand Down Expand Up @@ -104,10 +101,6 @@ Errors JointAxis::Load(ElementPtr _sdf)

this->dataPtr->sdf = _sdf;

// Read the initial position. This is optional, with a default value of 0.
this->dataPtr->initialPosition = _sdf->Get<double>(
"initial_position", 0.0).first;

// Read the xyz values.
if (_sdf->HasElement("xyz"))
{
Expand Down Expand Up @@ -167,17 +160,6 @@ Errors JointAxis::Load(ElementPtr _sdf)
return errors;
}

/////////////////////////////////////////////////
double JointAxis::InitialPosition() const
{
return this->dataPtr->initialPosition;
}
/////////////////////////////////////////////////
void JointAxis::SetInitialPosition(const double _pos)
{
this->dataPtr->initialPosition = _pos;
}

/////////////////////////////////////////////////
ignition::math::Vector3d JointAxis::Xyz() const
{
Expand Down
8 changes: 0 additions & 8 deletions src/JointAxis_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ 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 @@ -39,11 +36,6 @@ 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

{
sdf::Errors errors = axis.SetXyz(ignition::math::Vector3d(0, 1, 0));
EXPECT_TRUE(errors.empty());
Expand Down
9 changes: 4 additions & 5 deletions test/integration/joint_axis_dom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ 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 All @@ -113,6 +108,10 @@ TEST(DOMJointAxis, Complete)

EXPECT_DOUBLE_EQ(10.6, axis->SpringStiffness());
EXPECT_DOUBLE_EQ(0.0, axis2->SpringStiffness());

// Ensure that //axis/initial_position is removed during conversion
EXPECT_FALSE(axis->Element()->HasElement("initial_position"));
EXPECT_FALSE(axis2->Element()->HasElement("initial_position"));
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit efe5ff1

Please sign in to comment.