The Criteria class is used to specify how a Linkage should be constructed.
More...
#include <Linkage.hpp>
|
struct | Target |
| This structure defines targets for the expansion criteria and the desired behavior for those targets. More...
|
|
struct | Terminal |
| Any expansion performed by the criteria will be halted if mTerminal is reached. More...
|
|
|
std::vector< BodyNode * > | satisfy () const |
| Return a vector of BodyNodes that satisfy the parameters of the Criteria. More...
|
|
| Criteria ()=default |
| Constructs an empty criteria that will lead to creating an empty Linkage. More...
|
|
| Criteria (BodyNode *start, BodyNode *target, bool includeUpstreamParentJoint=false) |
| Utility constructor to create a contiguous sequence of BodyNodes that doesn't include branches in it. More...
|
|
|
void | refreshTerminalMap () const |
| Refresh the content of mMapOfTerminals. More...
|
|
void | expansionPolicy (BodyNode *_start, ExpansionPolicy _policy, std::vector< BodyNode * > &_bns) const |
| Satisfy the expansion policy of a target. More...
|
|
void | expandDownstream (BodyNode *_start, std::vector< BodyNode * > &_bns, bool _includeStart) const |
| Expand downstream. More...
|
|
void | expandUpstream (BodyNode *_start, std::vector< BodyNode * > &_bns, bool _includeStart) const |
| Expand upstream. More...
|
|
void | expandToTarget (const Target &_start, const Target &_target, std::vector< BodyNode * > &_bns) const |
| Construct a path from start to target. More...
|
|
std::vector< BodyNode * > | climbToTarget (BodyNode *_start, BodyNode *_target) const |
| Expand upwards from the _start BodyNode to the _target BodyNode. More...
|
|
std::vector< BodyNode * > | climbToCommonRoot (const Target &_start, const Target &_target, bool _chain) const |
| Expand upwards from both BodyNodes to a common root. More...
|
|
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. More...
|
|
The Criteria class is used to specify how a Linkage should be constructed.
◆ ExpansionPolicy
The ExpansionPolicy indicates how the collection of BodyNodes should expand from the starting BodyNode (mStart)
Enumerator |
---|
INCLUDE | Do not expand from the target.
Include everything up to the target and then stop.
|
EXCLUDE | Do not expand from the target.
Include everything up to the target, but NOT the target, and then stop.
|
DOWNSTREAM | Include the target, and then expand downstream, toward the leaves of the tree.
|
UPSTREAM | Include the target, and then expand upstream, toward the root of the tree.
|
◆ Criteria() [1/2]
dart::dynamics::Linkage::Criteria::Criteria |
( |
| ) |
|
|
default |
Constructs an empty criteria that will lead to creating an empty Linkage.
◆ Criteria() [2/2]
dart::dynamics::Linkage::Criteria::Criteria |
( |
BodyNode * |
start, |
|
|
BodyNode * |
target, |
|
|
bool |
includeUpstreamParentJoint = false |
|
) |
| |
Utility constructor to create a contiguous sequence of BodyNodes that doesn't include branches in it.
The start and target can be interchangeably set if both are included in the sequence.
- Parameters
-
[in] | start | The first BodyNode in the sequence. If nullptr is passed the sequence will expand from target to the root. |
[in] | target | The second BodyNode in the sequence. If nullptr is passed the sequence will expand from start to the root. |
[in] | includeUpstreamParentJoint | Set this to true if the parent joint of whichever is upstream of the other should be included. |
◆ climbToCommonRoot()
std::vector< BodyNode * > dart::dynamics::Linkage::Criteria::climbToCommonRoot |
( |
const Target & |
_start, |
|
|
const Target & |
_target, |
|
|
bool |
_chain |
|
) |
| const |
|
protected |
Expand upwards from both BodyNodes to a common root.
◆ climbToTarget()
std::vector< BodyNode * > dart::dynamics::Linkage::Criteria::climbToTarget |
( |
BodyNode * |
_start, |
|
|
BodyNode * |
_target |
|
) |
| const |
|
protected |
◆ expandDownstream()
void dart::dynamics::Linkage::Criteria::expandDownstream |
( |
BodyNode * |
_start, |
|
|
std::vector< BodyNode * > & |
_bns, |
|
|
bool |
_includeStart |
|
) |
| const |
|
protected |
◆ expandToTarget()
void dart::dynamics::Linkage::Criteria::expandToTarget |
( |
const Target & |
_start, |
|
|
const Target & |
_target, |
|
|
std::vector< BodyNode * > & |
_bns |
|
) |
| const |
|
protected |
Construct a path from start to target.
◆ expandUpstream()
void dart::dynamics::Linkage::Criteria::expandUpstream |
( |
BodyNode * |
_start, |
|
|
std::vector< BodyNode * > & |
_bns, |
|
|
bool |
_includeStart |
|
) |
| const |
|
protected |
◆ expansionPolicy()
Satisfy the expansion policy of a target.
◆ refreshTerminalMap()
void dart::dynamics::Linkage::Criteria::refreshTerminalMap |
( |
| ) |
const |
|
protected |
Refresh the content of mMapOfTerminals.
◆ satisfy()
std::vector< BodyNode * > dart::dynamics::Linkage::Criteria::satisfy |
( |
| ) |
const |
Return a vector of BodyNodes that satisfy the parameters of the Criteria.
◆ trimBodyNodes()
void dart::dynamics::Linkage::Criteria::trimBodyNodes |
( |
std::vector< BodyNode * > & |
_bns, |
|
|
bool |
_chain, |
|
|
bool |
_movingUpstream |
|
) |
| const |
|
protected |
Crawl through the list and cut it off anywhere that the criteria is violated.
◆ mMapOfTerminals
std::unordered_map<BodyNode*, bool> dart::dynamics::Linkage::Criteria::mMapOfTerminals |
|
mutableprotected |
Hashed set for terminals to allow quick lookup.
◆ mStart
Target dart::dynamics::Linkage::Criteria::mStart |
This Target will serve as the starting point for the criteria satisfaction.
◆ mTargets
std::vector<Target> dart::dynamics::Linkage::Criteria::mTargets |
The Linkage will extend from mStart to each of these targets.
Each BodyNode along the way will be included in the Linkage, including the mTarget. However, if a terminal BodyNode is reached along the way, then nothing past the terminal BodyNode will be included. Therefore, If you want to expand towards a target but not include the target, you can set the BodyNode as both an mTarget and an mTerminal, and set the mInclusive flag in mTerminal to false.
◆ mTerminals
std::vector<Terminal> dart::dynamics::Linkage::Criteria::mTerminals |
Any expansion (whether from an ExpansionPolicy or an attempt to reach an entry in mTargets) will be halted if it reaches any entry in mTerminal.