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

Rename CanonicalLink to RootLink #234

Merged
merged 6 commits into from
Mar 23, 2021
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
9 changes: 9 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ release will remove the deprecated code.

1. Depends on sdformat11.

1. `ignition::physics::FindFreeGroupFeature::Implementation::GetFreeGroupCanonicalLink`
has been replaced by `ignition::physics::FindFreeGroupFeature::Implementation::GetFreeGroupRootLink`.

### Deprecations

1. **physics/FreeGroup.hh**
+ **Deprecation:** `Identity ignition::physics::FreeGroup::CanonicalLink(const Identity &_groupID)`
+ **Replacement:** `Identity ignition::physics::FreeGroup::RootLink(const Identity &_groupID)`

## Ignition Physics 2.X to 3.X

### Modifications
Expand Down
3 changes: 1 addition & 2 deletions dartsim/src/FreeGroupFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ Identity FreeGroupFeatures::FindFreeGroupForLink(
}

/////////////////////////////////////////////////
Identity FreeGroupFeatures::GetFreeGroupCanonicalLink(
const Identity &_groupID) const
Identity FreeGroupFeatures::GetFreeGroupRootLink(const Identity &_groupID) const
{
const FreeGroupInfo &info = GetCanonicalInfo(_groupID);
return this->GenerateIdentity(this->links.IdentityOf(info.link));
Expand Down
4 changes: 2 additions & 2 deletions dartsim/src/FreeGroupFeatures.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ class FreeGroupFeatures

Identity FindFreeGroupForLink(const Identity &_linkID) const override;

Identity GetFreeGroupCanonicalLink(const Identity &_groupID) const override;
Identity GetFreeGroupRootLink(const Identity &_groupID) const override;

struct FreeGroupInfo
{
/// \brief Pointer to the canonical link
/// \brief Pointer to the root link
DartBodyNode *link;

/// \brief If the FreeGroup is wrapping an entire model, then this will
Expand Down
25 changes: 19 additions & 6 deletions include/ignition/physics/FreeGroup.hh
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,26 @@ namespace ignition
public: template <typename PolicyT, typename FeaturesT>
class FreeGroup : public virtual Entity<PolicyT, FeaturesT>
{
/// \brief The canonical link of this FreeGroup. Getting and setting
/// properties (like poses and velocities) on the group will be done
/// in terms of this link.
public: LinkPtr<PolicyT, FeaturesT> CanonicalLink();
/// \brief The root link of this FreeGroup. This link is the root of one
/// of the kinematic trees represented by this FreeGroup. Getting and
/// setting properties (like poses and velocities) on the group will be
/// done in terms of this link.
public: LinkPtr<PolicyT, FeaturesT> RootLink();

/// \brief const version of RootLink()
public: ConstLinkPtr<PolicyT, FeaturesT> RootLink() const;

/// \brief The root link of this FreeGroup. This link is the root of one
/// of the kinematic trees represented by this FreeGroup. Getting and
/// setting properties (like poses and velocities) on the group will be
/// done in terms of this link.
/// DEPRECATED. Please use RootLink()
public: LinkPtr<PolicyT, FeaturesT> IGN_DEPRECATED(4.0) CanonicalLink();

/// \brief const version of CanonicalLink()
public: ConstLinkPtr<PolicyT, FeaturesT> CanonicalLink() const;
/// DEPRECATED. Please use RootLink()
public: ConstLinkPtr<PolicyT, FeaturesT> IGN_DEPRECATED(4.0)
CanonicalLink() const;
};

public: template <typename PolicyT>
Expand All @@ -95,7 +108,7 @@ namespace ignition
public: virtual Identity FindFreeGroupForLink(
const Identity &_linkID) const = 0;

public: virtual Identity GetFreeGroupCanonicalLink(
public: virtual Identity GetFreeGroupRootLink(
const Identity &_groupID) const = 0;
};
};
Expand Down
26 changes: 21 additions & 5 deletions include/ignition/physics/detail/FreeGroup.hh
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,37 @@ namespace ignition
/////////////////////////////////////////////////
template <typename PolicyT, typename FeaturesT>
LinkPtr<PolicyT, FeaturesT>
FindFreeGroupFeature::FreeGroup<PolicyT, FeaturesT>::CanonicalLink()
FindFreeGroupFeature::FreeGroup<PolicyT, FeaturesT>::RootLink()
{
return LinkPtr<PolicyT, FeaturesT>(this->pimpl,
this->template Interface<FindFreeGroupFeature>()
->GetFreeGroupCanonicalLink(this->identity));
->GetFreeGroupRootLink(this->identity));
}

/////////////////////////////////////////////////
template <typename PolicyT, typename FeaturesT>
ConstLinkPtr<PolicyT, FeaturesT>
FindFreeGroupFeature::FreeGroup<PolicyT, FeaturesT>::CanonicalLink() const
ConstLinkPtr<PolicyT, FeaturesT> FindFreeGroupFeature::FreeGroup<
PolicyT, FeaturesT>::RootLink() const
{
return LinkPtr<PolicyT, FeaturesT>(this->pimpl,
this->template Interface<FindFreeGroupFeature>()
->GetFreeGroupCanonicalLink(this->identity));
->GetFreeGroupRootLink(this->identity));
}

/////////////////////////////////////////////////
template <typename PolicyT, typename FeaturesT>
LinkPtr<PolicyT, FeaturesT>
FindFreeGroupFeature::FreeGroup<PolicyT, FeaturesT>::CanonicalLink()
{
return this->RootLink();
}

/////////////////////////////////////////////////
template <typename PolicyT, typename FeaturesT>
ConstLinkPtr<PolicyT, FeaturesT>
FindFreeGroupFeature::FreeGroup<PolicyT, FeaturesT>::CanonicalLink() const
{
return this->RootLink();
}

/////////////////////////////////////////////////
Expand Down
3 changes: 1 addition & 2 deletions tpe/plugin/src/FreeGroupFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ Identity FreeGroupFeatures::FindFreeGroupForLink(
}

/////////////////////////////////////////////////
Identity FreeGroupFeatures::GetFreeGroupCanonicalLink(
const Identity &_groupID) const
Identity FreeGroupFeatures::GetFreeGroupRootLink(const Identity &_groupID) const
{
// assume no canonical link for now
// assume groupID ~= modelID
Expand Down
2 changes: 1 addition & 1 deletion tpe/plugin/src/FreeGroupFeatures.hh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class FreeGroupFeatures :

Identity FindFreeGroupForLink(const Identity &_linkID) const override;

Identity GetFreeGroupCanonicalLink(const Identity &_groupID) const override;
Identity GetFreeGroupRootLink(const Identity &_groupID) const override;

void SetFreeGroupWorldPose(
const Identity &_groupID,
Expand Down
4 changes: 4 additions & 0 deletions tpe/plugin/src/SimulationFeatures_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <ignition/math/Vector3.hh>
#include <ignition/math/eigen3/Conversions.hh>

#include <ignition/utils/SuppressWarning.hh>
#include <ignition/plugin/Loader.hh>

// Features
Expand Down Expand Up @@ -257,7 +258,10 @@ TEST_P(SimulationFeatures_TEST, FreeGroup)
auto model = world->GetModel("sphere");
auto freeGroup = model->FindFreeGroup();
ASSERT_NE(nullptr, freeGroup);
IGN_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION
ASSERT_NE(nullptr, freeGroup->CanonicalLink());
IGN_UTILS_WARN_RESUME__DEPRECATED_DECLARATION
ASSERT_NE(nullptr, freeGroup->RootLink());

auto link = model->GetLink("sphere_link");
auto freeGroupLink = link->FindFreeGroup();
Expand Down