33 #ifndef DART_DYNAMICS_LINKAGE_HPP_ 34 #define DART_DYNAMICS_LINKAGE_HPP_ 36 #include <unordered_set> 37 #include "dart/dynamics/ReferentialSkeleton.hpp" 74 std::vector<BodyNode*>
satisfy()
const;
152 bool includeUpstreamParentJoint =
false);
162 std::vector<BodyNode*>& _bns)
const;
167 std::vector<BodyNode*>& _bns,
168 bool _includeStart)
const;
173 std::vector<BodyNode*>& _bns,
174 bool _includeStart)
const;
180 std::vector<BodyNode*>& _bns)
const;
188 const Target& _start,
const Target& _target,
bool _chain)
const;
193 std::vector<BodyNode*>& _bns,
bool _chain,
bool _movingUpstream)
const;
201 const Criteria& _criteria,
const std::string& _name =
"Linkage");
207 LinkagePtr
cloneLinkage(
const std::string& cloneName)
const;
214 const std::string& cloneName)
const override;
229 Linkage(
const Criteria& _criteria,
const std::string& _name =
"Linkage");
245 #endif // DART_DYNAMICS_LINKAGE_HPP_ A Linkage is a ReferentialSkeleton with the special property that all the BodyNodes included in it fo...
Definition: Linkage.hpp:53
This structure defines targets for the expansion criteria and the desired behavior for those targets...
Definition: Linkage.hpp:78
void expandToTarget(const Target &_start, const Target &_target, std::vector< BodyNode *> &_bns) const
Construct a path from start to target.
Definition: Linkage.cpp:353
bool mChain
If this is set to true, the expansion towards this target will terminate if (1) a fork/split in the k...
Definition: Linkage.hpp:96
Linkage(const Criteria &_criteria, const std::string &_name="Linkage")
Constructor for the Linkage class.
Definition: Linkage.cpp:636
LinkagePtr cloneLinkage() const
Creates and returns a clone of this Linkage.
Definition: Linkage.cpp:549
std::vector< BodyNode * > climbToTarget(BodyNode *_start, BodyNode *_target) const
Expand upwards from the _start BodyNode to the _target BodyNode.
Definition: Linkage.cpp:401
ExpansionPolicy
The ExpansionPolicy indicates how the collection of BodyNodes should expand from the starting BodyNod...
Definition: Linkage.hpp:61
void refreshTerminalMap() const
Refresh the content of mMapOfTerminals.
Definition: Linkage.cpp:154
Include the target, and then expand downstream, toward the leaves of the tree.
Definition: Linkage.hpp:67
ExpansionPolicy mPolicy
After the target has been reached (if it is reached), the Linkage will start to follow this expansion...
Definition: Linkage.hpp:91
WeakBodyNodePtr mTerminal
BodyNode that should halt any expansion.
Definition: Linkage.hpp:123
Do not expand from the target.
Definition: Linkage.hpp:65
WeakBodyNodePtr mNode
The Linkage will expand from the starting BodyNode up to this node.
Definition: Linkage.hpp:87
void expandDownstream(BodyNode *_start, std::vector< BodyNode *> &_bns, bool _includeStart) const
Expand downstream.
Definition: Linkage.cpp:253
Include the target, and then expand upstream, toward the root of the tree.
Definition: Linkage.hpp:69
std::vector< BodyNode * > climbToCommonRoot(const Target &_start, const Target &_target, bool _chain) const
Expand upwards from both BodyNodes to a common root.
Definition: Linkage.cpp:422
std::vector< WeakBodyNodePtr > mParentBodyNodes
Recording of the parent BodyNodes that were held by each of the BodyNodes when the Linkage was constr...
Definition: Linkage.hpp:239
static LinkagePtr create(const Criteria &_criteria, const std::string &_name="Linkage")
Create a Linkage with the given Criteria.
Definition: Linkage.cpp:514
Definition: Aspect.cpp:40
std::vector< BodyNode * > satisfy() const
Return a vector of BodyNodes that satisfy the parameters of the Criteria.
Definition: Linkage.cpp:43
Target(BodyNode *_target=nullptr, ExpansionPolicy _policy=INCLUDE, bool _chain=false)
Default constructor for Target.
Definition: Linkage.cpp:109
void expansionPolicy(BodyNode *_start, ExpansionPolicy _policy, std::vector< BodyNode *> &_bns) const
Satisfy the expansion policy of a target.
Definition: Linkage.cpp:164
bool isAssembled() const
Returns false if the original assembly of this Linkage has been broken in some way.
Definition: Linkage.cpp:598
The Criteria class is used to specify how a Linkage should be constructed.
Definition: Linkage.hpp:57
void satisfyCriteria()
Redefine this Linkage so that its Criteria is satisfied.
Definition: Linkage.cpp:621
Criteria()=default
Constructs an empty criteria that will lead to creating an empty Linkage.
BodyNode class represents a single node of the skeleton.
Definition: BodyNode.hpp:74
ReferentialSkeleton is a base class used to implement Linkage, Group, and other classes that are used...
Definition: ReferentialSkeleton.hpp:47
void reassemble()
Revert the assembly of this Linkage to its original structure.
Definition: Linkage.cpp:611
std::vector< Target > mTargets
The Linkage will extend from mStart to each of these targets.
Definition: Linkage.hpp:110
std::unordered_map< BodyNode *, bool > mMapOfTerminals
Hashed set for terminals to allow quick lookup.
Definition: Linkage.hpp:196
void expandUpstream(BodyNode *_start, std::vector< BodyNode *> &_bns, bool _includeStart) const
Expand upstream.
Definition: Linkage.cpp:280
Criteria mCriteria
Criteria that defines the structure of this Linkage.
Definition: Linkage.hpp:235
void trimBodyNodes(std::vector< BodyNode *> &_bns, bool _chain, bool _movingUpstream) const
Crawl through the list and cut it off anywhere that the criteria is violated.
Definition: Linkage.cpp:458
Do not expand from the target.
Definition: Linkage.hpp:63
std::vector< Terminal > mTerminals
Any expansion (whether from an ExpansionPolicy or an attempt to reach an entry in mTargets) will be h...
Definition: Linkage.hpp:132
Any expansion performed by the criteria will be halted if mTerminal is reached.
Definition: Linkage.hpp:117
virtual void update()
Update any metadata needed by the Linkage or its derived classes.
Definition: Linkage.cpp:644
bool mInclusive
Whether or not the BodyNode should be included after expansion has halted.
Definition: Linkage.hpp:127
Target mStart
This Target will serve as the starting point for the criteria satisfaction.
Definition: Linkage.hpp:101