diff --git a/bullet-featherstone/src/SDFFeatures.cc b/bullet-featherstone/src/SDFFeatures.cc index 9bd589ba4..73ae93656 100644 --- a/bullet-featherstone/src/SDFFeatures.cc +++ b/bullet-featherstone/src/SDFFeatures.cc @@ -945,18 +945,6 @@ bool SDFFeatures::AddSdfCollision( return true; } -Identity SDFFeatures::GetCollision( - const Identity &_linkID, - const std::string &_collisionName) -{ - const auto *link = this->ReferenceInterface(_linkID); - const auto it = link->collisionNameToEntityId.find(_collisionName); - if (it == link->collisionNameToEntityId.end()) - return this->GenerateInvalidId(); - - return this->GenerateIdentity(it->second, this->collisions.at(it->second)); -} - Identity SDFFeatures::ConstructSdfCollision( const Identity &_linkID, const ::sdf::Collision &_collision) diff --git a/bullet-featherstone/src/SDFFeatures.hh b/bullet-featherstone/src/SDFFeatures.hh index 9e4c44c70..2285c1a4b 100644 --- a/bullet-featherstone/src/SDFFeatures.hh +++ b/bullet-featherstone/src/SDFFeatures.hh @@ -59,10 +59,6 @@ class SDFFeatures : private: Identity ConstructSdfCollision( const Identity &_linkID, const ::sdf::Collision &_collision) override; - - private: Identity GetCollision( - const Identity &_linkID, - const std::string &_collisionName) override; }; } // namespace bullet_featherstone diff --git a/bullet/src/SDFFeatures.cc b/bullet/src/SDFFeatures.cc index 6ac4a0c5d..4fced5fd7 100644 --- a/bullet/src/SDFFeatures.cc +++ b/bullet/src/SDFFeatures.cc @@ -202,25 +202,6 @@ Identity SDFFeatures::ConstructSdfLink( return linkIdentity; } -Identity SDFFeatures::GetCollision( - const Identity &_linkID, - const std::string &_collisionName) -{ - const auto link = this->ReferenceInterface(_linkID); - const auto it = std::find_if( - link->shapes.begin(), - link->shapes.end(), - [this, &_collisionName](const auto& shapeID) - { - return _collisionName == this->collisions.at(shapeID)->name; - }); - - if (it == link->shapes.end()) - return this->GenerateInvalidId(); - - return this->GenerateIdentity(*it, this->collisions.at(*it)); -} - Identity SDFFeatures::ConstructSdfCollision( const Identity &_linkID, const ::sdf::Collision &_collision) diff --git a/bullet/src/SDFFeatures.hh b/bullet/src/SDFFeatures.hh index 0c3cd7a98..d3e2bcae3 100644 --- a/bullet/src/SDFFeatures.hh +++ b/bullet/src/SDFFeatures.hh @@ -62,10 +62,6 @@ class SDFFeatures : const Identity &_linkID, const ::sdf::Collision &_collision) override; - private: Identity GetCollision( - const Identity &_linkID, - const std::string &_collisionName) override; - private: Identity ConstructSdfJoint( const Identity &_modelID, const ::sdf::Joint &_sdfJoint) override; diff --git a/dartsim/src/SDFFeatures.cc b/dartsim/src/SDFFeatures.cc index 19d264615..b76ac9ba3 100644 --- a/dartsim/src/SDFFeatures.cc +++ b/dartsim/src/SDFFeatures.cc @@ -669,32 +669,6 @@ Identity SDFFeatures::ConstructSdfLink( return linkIdentity; } -Identity SDFFeatures::GetCollision( - const Identity &_linkID, - const std::string &_collisionName) -{ - auto bn = this->ReferenceInterface(_linkID)->link; - - DartShapeNode *const sn = bn->getSkeleton()->getShapeNode( - bn->getName() + ":" + _collisionName); - - // If the shape doesn't exist in "shapes", it means the containing entity has - // been removed. - if (this->shapes.HasEntity(sn)) - { - const std::size_t shapeID = this->shapes.IdentityOf(sn); - return this->GenerateIdentity(shapeID, this->shapes.at(shapeID)); - } - else - { - // TODO(addisu) It's not clear what to do when `GetShape` is called on a - // link that has been removed. Right now we are returning an invalid - // identity, but that could cause a segfault if the use doesn't check if - // returned value before using it. - return this->GenerateInvalidId(); - } -} - ///////////////////////////////////////////////// Identity SDFFeatures::ConstructSdfJoint( const Identity &_modelID, diff --git a/dartsim/src/SDFFeatures.hh b/dartsim/src/SDFFeatures.hh index 18bc25319..4dcdfda84 100644 --- a/dartsim/src/SDFFeatures.hh +++ b/dartsim/src/SDFFeatures.hh @@ -75,10 +75,6 @@ class SDFFeatures : const Identity &_linkID, const ::sdf::Collision &_collision) override; - public: Identity GetCollision( - const Identity &_linkID, - const std::string &_collisionName) override; - public: Identity ConstructSdfVisual( const Identity &_linkID, const ::sdf::Visual &_visual) override; diff --git a/sdf/include/gz/physics/sdf/ConstructCollision.hh b/sdf/include/gz/physics/sdf/ConstructCollision.hh index eefc2bddd..b19660704 100644 --- a/sdf/include/gz/physics/sdf/ConstructCollision.hh +++ b/sdf/include/gz/physics/sdf/ConstructCollision.hh @@ -36,8 +36,6 @@ class ConstructSdfCollision : public virtual Feature public: using ShapePtrType = ShapePtr; public: ShapePtrType ConstructCollision(const ::sdf::Collision &_collision); - - public: ShapePtrType GetCollision(const std::string &_collisionName); }; public: template @@ -45,9 +43,6 @@ class ConstructSdfCollision : public virtual Feature { public: virtual Identity ConstructSdfCollision( const Identity &_linkID, const ::sdf::Collision &_collision) = 0; - - public: virtual Identity GetCollision( - const Identity &_linkID, const std::string &_collisionName) = 0; }; }; @@ -60,15 +55,6 @@ auto ConstructSdfCollision::Link::ConstructCollision( this->template Interface() ->ConstructSdfCollision(this->identity, _collision)); } -///////////////////////////////////////////////// -template -auto ConstructSdfCollision::Link::GetCollision( - const std::string &_collisionName) -> ShapePtrType -{ - return ShapePtrType(this->pimpl, - this->template Interface() - ->GetCollision(this->identity, _collisionName)); -} } } } diff --git a/tpe/plugin/src/SDFFeatures.cc b/tpe/plugin/src/SDFFeatures.cc index e20fccaa1..409e222c7 100644 --- a/tpe/plugin/src/SDFFeatures.cc +++ b/tpe/plugin/src/SDFFeatures.cc @@ -250,32 +250,6 @@ Identity SDFFeatures::ConstructSdfLink( return linkIdentity; } -///////////////////////////////////////////////// -Identity SDFFeatures::GetCollision( - const Identity &_linkID, - const std::string &_collisionName) -{ - auto linkInfo = this->ReferenceInterface(_linkID); - if (linkInfo != nullptr) - { - tpelib::Entity &shapeEnt = linkInfo->link->GetChildByName(_collisionName); - for (auto it = this->collisions.begin(); - it != this->collisions.end(); - ++it) - { - if (it->second != nullptr) - { - std::string name = it->second->collision->GetName(); - if (it->first == shapeEnt.GetId() && name == shapeEnt.GetName()) - { - return this->GenerateIdentity(it->first, it->second); - } - } - } - } - return this->GenerateInvalidId(); -} - ///////////////////////////////////////////////// Identity SDFFeatures::ConstructSdfCollision( const Identity &_linkID, diff --git a/tpe/plugin/src/SDFFeatures.hh b/tpe/plugin/src/SDFFeatures.hh index 5242cbaba..17268a3ee 100644 --- a/tpe/plugin/src/SDFFeatures.hh +++ b/tpe/plugin/src/SDFFeatures.hh @@ -63,10 +63,6 @@ class SDFFeatures : private: Identity ConstructSdfCollision( const Identity &_linkID, const ::sdf::Collision &_collision) override; - - private: Identity GetCollision( - const Identity &_linkID, - const std::string &_collisionName) override; }; }