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 2 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
2 changes: 1 addition & 1 deletion dartsim/src/FreeGroupFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Identity FreeGroupFeatures::FindFreeGroupForLink(
}

/////////////////////////////////////////////////
Identity FreeGroupFeatures::GetFreeGroupCanonicalLink(
Identity FreeGroupFeatures::GetFreeGroupUnconstrainedLink(
const Identity &_groupID) const
{
const FreeGroupInfo &info = GetCanonicalInfo(_groupID);
Expand Down
5 changes: 3 additions & 2 deletions dartsim/src/FreeGroupFeatures.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ class FreeGroupFeatures

Identity FindFreeGroupForLink(const Identity &_linkID) const override;

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

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

/// \brief If the FreeGroup is wrapping an entire model, then this will
Expand Down
19 changes: 15 additions & 4 deletions include/ignition/physics/FreeGroup.hh
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,24 @@ 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
/// \brief The unconstrained 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();
public: LinkPtr<PolicyT, FeaturesT> UnconstrainedLink();

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

/// \brief The unconstrained link of this FreeGroup. Getting and setting
/// properties (like poses and velocities) on the group will be done
/// in terms of this link.
/// DEPRECATED. Pleaes use UnconstrainedLink()
public: LinkPtr<PolicyT, FeaturesT> CanonicalLink() IGN_DEPRECATED(4.0);

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

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

public: virtual Identity GetFreeGroupCanonicalLink(
public: virtual Identity GetFreeGroupUnconstrainedLink(
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>::UnconstrainedLink()
{
return LinkPtr<PolicyT, FeaturesT>(this->pimpl,
this->template Interface<FindFreeGroupFeature>()
->GetFreeGroupCanonicalLink(this->identity));
->GetFreeGroupUnconstrainedLink(this->identity));
}

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

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

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

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

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

Identity FindFreeGroupForLink(const Identity &_linkID) const override;

Identity GetFreeGroupCanonicalLink(const Identity &_groupID) const override;
Identity GetFreeGroupUnconstrainedLink(
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 @@ -235,7 +236,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->UnconstrainedLink());

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