Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate semantics support in core data structures #622

Merged
merged 3 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ to normalize errors or as initial points of a nonlinear optimization procedure.
- The changelog has been migrated to the format described in https://keepachangelog.com/en/1.0.0/ .
- The CMake config files are now installed in ${CMAKE_INSTALL_PREFIX}/lib/cmake/iDynTree also in Windows.

### Deprecated
- All the classes and methods that end in Semantics are deprecated, and will be removed in iDynTree 2.0, see https://github.com/robotology/idyntree/pull/622 for more info.
- The CMake option IDYNTREE_USES_KDL and all the classes available when enabling it are deprecated, and will be removed in iDynTree 2.0 .

### Fixed
- Fixed missing `DOF_ACCELLERATION` data in dynamic variable cache ordering
(https://github.com/robotology/idyntree/pull/587)
Expand Down
8 changes: 7 additions & 1 deletion src/core/include/iDynTree/Core/AngularForceVector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <iDynTree/Core/ForceVector3.h>
#include <iDynTree/Core/PrivateMotionForceVertorAssociations.h>
#include <iDynTree/Core/Utils.h>

namespace iDynTree
{
Expand All @@ -24,7 +25,8 @@ namespace iDynTree
/**
* Class providing the semantics for any angular force vector (torque or angular momentum).
*/
class AngularForceVector3Semantics: public ForceVector3Semantics<AngularForceVector3Semantics>
class
AngularForceVector3Semantics: public ForceVector3Semantics<AngularForceVector3Semantics>
{
protected:
int point;
Expand All @@ -34,17 +36,21 @@ namespace iDynTree
* Constructors:
*/
inline AngularForceVector3Semantics() {}
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
AngularForceVector3Semantics(int _point, int _body, int _refBody, int _coordinateFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
AngularForceVector3Semantics(const AngularForceVector3Semantics & other);

/**
* Semantics operations
* Compute the semantics of the result given the semantics of the operands.
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
bool changePoint(const PositionSemantics & newPoint,
const LinearForceVector3Semantics & otherLinear,
AngularForceVector3Semantics & resultAngular) const;

IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
static bool compose(const AngularForceVector3Semantics & op1,
const AngularForceVector3Semantics & op2,
AngularForceVector3Semantics & result);
Expand Down
3 changes: 3 additions & 0 deletions src/core/include/iDynTree/Core/AngularMotionVector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <iDynTree/Core/MotionVector3.h>
#include <iDynTree/Core/PrivateMotionForceVertorAssociations.h>
#include <iDynTree/Core/Utils.h>

namespace iDynTree
{
Expand All @@ -26,7 +27,9 @@ namespace iDynTree
* Constructors:
*/
AngularMotionVector3Semantics();
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
AngularMotionVector3Semantics(int _body, int _refBody, int _coordinateFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
AngularMotionVector3Semantics(const AngularMotionVector3Semantics & other);
};

Expand Down
5 changes: 5 additions & 0 deletions src/core/include/iDynTree/Core/GeomVector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <iDynTree/Core/VectorFixSize.h>
#include <iDynTree/Core/Rotation.h>
#include <iDynTree/Core/PrivateMotionForceVertorAssociations.h>
#include <iDynTree/Core/Utils.h>

#define GEOMVECTOR3SEMANTICS_TEMPLATE_HDR \
template <class MotionForceSemanticsT>
Expand Down Expand Up @@ -41,7 +42,9 @@ namespace iDynTree
* Constructors:
*/
inline GeomVector3Semantics() {}
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
GeomVector3Semantics(int _body, int _refBody, int _coordinateFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
GeomVector3Semantics(const GeomVector3Semantics & other);

void setToUnknown();
Expand Down Expand Up @@ -97,7 +100,9 @@ namespace iDynTree
/**
* Getters & setters
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
const MotionForceSemanticsT& getSemantics() const;
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setSemantics(MotionForceSemanticsT& _semantics);

/**
Expand Down
2 changes: 2 additions & 0 deletions src/core/include/iDynTree/Core/LinearForceVector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ namespace iDynTree
* Constructors:
*/
inline LinearForceVector3Semantics() {}
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
LinearForceVector3Semantics(int _body, int _refBody, int _coordinateFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
LinearForceVector3Semantics(const LinearForceVector3Semantics & other);
};

Expand Down
4 changes: 4 additions & 0 deletions src/core/include/iDynTree/Core/LinearMotionVector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ namespace iDynTree
* Constructors:
*/
inline LinearMotionVector3Semantics() {}
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
LinearMotionVector3Semantics(int _point, int _body, int _refBody, int _coordinateFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
LinearMotionVector3Semantics(const LinearMotionVector3Semantics & other);

/**
* Semantics operations
* Compute the semantics of the result given the semantics of the operands.
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
bool changePoint(const PositionSemantics & newPoint,
const AngularMotionVector3Semantics & otherAngular,
LinearMotionVector3Semantics & resultLinear) const;

IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
static bool compose(const LinearMotionVector3Semantics & op1,
const LinearMotionVector3Semantics & op2,
LinearMotionVector3Semantics & result);
Expand Down
2 changes: 2 additions & 0 deletions src/core/include/iDynTree/Core/Position.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ namespace iDynTree
/**
* Semantic getter
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
PositionSemantics& getSemantics();

/**
* Const Semantic getter
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
const PositionSemantics& getSemantics() const;

/**
Expand Down
2 changes: 2 additions & 0 deletions src/core/include/iDynTree/Core/Rotation.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ namespace iDynTree
/**
* Semantic getter
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
RotationSemantics& getSemantics();

/**
* Semantic getter
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
const RotationSemantics& getSemantics() const;

/**
Expand Down
18 changes: 17 additions & 1 deletion src/core/include/iDynTree/Core/RotationSemantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include <string>

#include <iDynTree/Core/Utils.h>

namespace iDynTree
{
class PositionSemantics;
Expand All @@ -22,7 +24,8 @@ namespace iDynTree
*
* \ingroup iDynTreeCore
*/
class RotationSemantics
class
RotationSemantics
{
protected:
int orientationFrame;
Expand Down Expand Up @@ -54,30 +57,43 @@ namespace iDynTree
* Constructor: initialize semantics from individual parameters
*
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
RotationSemantics(int _orientationFrame, int _body, int _refOrientationFrame, int _refBody);

/**
* Copy constructor: create a RotationSemantics from another RotationSemantics
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
RotationSemantics(const RotationSemantics & other);

IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setToUnknown();

/**
* @name Semantics setters and getters.
* Semantics setters and getters.
*/
///@{
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
int getOrientationFrame() const;
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
int getBody() const;
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
int getReferenceOrientationFrame() const;
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
int getRefBody() const;
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
int getCoordinateFrame() const;

IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setOrientationFrame(int _orientationFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setBody(int _body);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setReferenceOrientationFrame(int _refOrientationFrame);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setRefBody(int _refBody);
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
void setCoordinateFrame(int _coordinateFrame);
///@}

Expand Down
1 change: 1 addition & 0 deletions src/core/include/iDynTree/Core/SpatialVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ SpatialVectorSemantics<LinearVec3SemanticsT, AngularVec3SemanticsT>
*/
SpatialVectorSemantics(LinearVec3SemanticsT & linearVec3, AngularVec3SemanticsT & angularVec3);

IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
bool check_linear2angularConsistency(const LinearVec3SemanticsT & linearVec3, const AngularVec3SemanticsT & angularVec3);

/**
Expand Down
2 changes: 2 additions & 0 deletions src/core/include/iDynTree/Core/Transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,13 @@ namespace iDynTree
/**
* Semantic accessor
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
TransformSemantics & getSemantics();

/**
* Const semantic getter
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
const TransformSemantics & getSemantics() const;

/**
Expand Down
6 changes: 6 additions & 0 deletions src/core/include/iDynTree/Core/TransformSemantics.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

#include <string>

#include <iDynTree/Core/Utils.h>

namespace iDynTree
{
class PositionSemantics;
Expand Down Expand Up @@ -44,12 +46,14 @@ namespace iDynTree
/**
* Constructor: initialize all semantics from a Transform object (create links)
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
TransformSemantics(PositionSemantics & position, RotationSemantics & rotation);


/**
* Get the rotation part of the transform
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
const RotationSemantics & getRotationSemantics() const;

/**
Expand All @@ -60,11 +64,13 @@ namespace iDynTree
/**
* Set the rotation part of the transform
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
bool setRotationSemantics(const RotationSemantics & rotation);

/**
* Set the translation part of the transform
*/
IDYNTREE_DEPRECATED_WITH_MSG("All iDynTree semantics class and methods will be removed in iDynTree 2.0")
bool setPositionSemantics(const PositionSemantics & position);

/**
Expand Down
31 changes: 12 additions & 19 deletions src/core/include/iDynTree/Core/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,24 @@
*/
#define IDYNTREE_UNUSED(var) ((void)var)


// Note: we set IDYNTREE_DEPRECATED to nothing when compiling idyntree-core and
// idyntree-high-level because some deprecated functions (mainly related to semantics)
// need still too be used, as they are going to be removed without any replacement
// When this functions will be removed as part of iDynTree 2.0, we can remove this special case
// Furthermore, SWIG has some problems with this attributes, so until we use a recent SWIG version
// we also disabled them for SWIG
/**
* \brief Macro to deprecate functions and methods
*
* see https://blog.samat.io/2017/02/27/Deprecating-functions-and-methods-in-Cplusplus/
*/
// C++14
#if __cplusplus >= 201402L
#if defined(__has_cpp_attribute)
#if __has_cpp_attribute(deprecated)
#define IDYNTREE_DEPRECATED [[deprecated]]
#define IDYNTREE_DEPRECATED_WITH_MSG(msg) [[deprecated(msg)]]
#endif
#endif
// Earlier standards
#if defined(idyntree_core_EXPORTS) || defined(idyntree_high_level_EXPORTS) || defined(SWIG)
#define IDYNTREE_DEPRECATED
#define IDYNTREE_DEPRECATED_WITH_MSG(msg)
#else
#if defined(__GNUC__) || defined(__clang__)
#define IDYNTREE_DEPRECATED __attribute__((deprecated))
#define IDYNTREE_DEPRECATED_WITH_MSG(msg) __attribute__((deprecated(msg)))
#elif defined(_MSC_VER)
#define IDYNTREE_DEPRECATED __declspec(deprecated)
#define IDYNTREE_DEPRECATED_WITH_MSG(msg) __declspec(deprecated(msg))
#else
#define IDYNTREE_DEPRECATED
#define IDYNTREE_DEPRECATED_WITH_MSG(msg)
#endif
#define IDYNTREE_DEPRECATED [[deprecated]]
#define IDYNTREE_DEPRECATED_WITH_MSG(msg) [[deprecated(msg)]]
#endif

namespace iDynTree
Expand Down
1 change: 0 additions & 1 deletion src/core/include/iDynTree/Core/Wrench.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ namespace iDynTree
*
* \ingroup iDynTreeCore
*
* Currently this class does not support semantics.
*/
class Wrench: public SpatialForceVector
{
Expand Down