Robowflex  v0.1
Making MoveIt Easy
robowflex::darts::ACM Class Reference

Allowable collision matrix for robowflex::darts::Structure. More...

#include <acm.h>

Public Member Functions

 ACM (const Structure *structure)
 Constructor. More...
 
const StructuregetStructure () const
 Get the structure this ACM is for. More...
 
Enabling / Disabling Collisions
void disableCollision (const std::string &a, const std::string &b)
 Disable collisions between body frames a and b. More...
 
void enableCollision (const std::string &a, const std::string &b)
 Enable collisions between body frames a and b. More...
 
ACM Information
std::set< std::pair< std::string, std::string > > & getDisabledPairs ()
 Get the pairs of frames that have collision disabled. More...
 
const std::set< std::pair< std::string, std::string > > & getDisabledPairsConst () const
 Get the pairs of frames that have collision disabled. More...
 
std::shared_ptr< dart::collision::BodyNodeCollisionFilter > getFilter ()
 Get the Dart collision filter corresponding to this ACM. More...
 
const std::shared_ptr< dart::collision::BodyNodeCollisionFilter > & getFilterConst () const
 Get the Dart collision filter corresponding to this ACM. More...
 

Private Member Functions

std::pair< std::string, std::stringmakeKey (const std::string &a, const std::string &b) const
 Create a unique key for two frame names. More...
 
dart::dynamics::BodyNode * getBodyNode (const std::string &key)
 Get the body node in the structure corresponding to the body frame name. More...
 

Private Attributes

const Structurestructure_
 Structure this ACM is for. More...
 
std::set< std::pair< std::string, std::string > > acm_
 Disabled collision pairs. More...
 
std::shared_ptr< dart::collision::BodyNodeCollisionFilter > filter_
 Collision filter. More...
 

Detailed Description

Allowable collision matrix for robowflex::darts::Structure.

Definition at line 33 of file acm.h.

Constructor & Destructor Documentation

◆ ACM()

ACM::ACM ( const Structure structure)

Constructor.

Parameters
[in]structureThe structure the ACM is for.

ACM

Definition at line 10 of file acm.cpp.

11  : structure_(structure), filter_(std::make_shared<dart::collision::BodyNodeCollisionFilter>())
12 {
13 }
std::shared_ptr< dart::collision::BodyNodeCollisionFilter > filter_
Collision filter.
Definition: acm.h:104
const Structure * structure_
Structure this ACM is for.
Definition: acm.h:102

Member Function Documentation

◆ disableCollision()

void ACM::disableCollision ( const std::string a,
const std::string b 
)

Disable collisions between body frames a and b.

Parameters
[in]aBody frame A.
[in]bBody frame B.

Definition at line 15 of file acm.cpp.

16 {
17  auto key = makeKey(a, b);
18  if (acm_.find(key) == acm_.end())
19  {
20  acm_.emplace(key);
21  filter_->addBodyNodePairToBlackList(getBodyNode(key.first), getBodyNode(key.second));
22  }
23 }
dart::dynamics::BodyNode * getBodyNode(const std::string &key)
Get the body node in the structure corresponding to the body frame name.
Definition: acm.cpp:69
std::pair< std::string, std::string > makeKey(const std::string &a, const std::string &b) const
Create a unique key for two frame names.
Definition: acm.cpp:61
std::set< std::pair< std::string, std::string > > acm_
Disabled collision pairs.
Definition: acm.h:103
T emplace(T... args)
T end(T... args)
T find(T... args)

◆ enableCollision()

void ACM::enableCollision ( const std::string a,
const std::string b 
)

Enable collisions between body frames a and b.

Parameters
[in]aBody frame A.
[in]bBody frame B.

Definition at line 25 of file acm.cpp.

26 {
27  auto key = makeKey(a, b);
28  auto it = acm_.find(key);
29  if (it != acm_.end())
30  {
31  filter_->removeBodyNodePairFromBlackList(getBodyNode(key.first), getBodyNode(key.second));
32  acm_.erase(it);
33  }
34 }
T erase(T... args)

◆ getBodyNode()

dart::dynamics::BodyNode * ACM::getBodyNode ( const std::string key)
private

Get the body node in the structure corresponding to the body frame name.

Parameters
[in]keyName of body frame.
Returns
Body frame in structure.

Definition at line 69 of file acm.cpp.

70 {
71  return structure_->getSkeletonConst()->getBodyNode(key);
72 }
const dart::dynamics::SkeletonPtr & getSkeletonConst() const
Get the underlying skeleton for the structure.
Definition: structure.cpp:113

◆ getDisabledPairs()

std::set< std::pair< std::string, std::string > > & ACM::getDisabledPairs ( )

Get the pairs of frames that have collision disabled.

Returns
The set of pairs with collision disabled.

Definition at line 51 of file acm.cpp.

52 {
53  return acm_;
54 }

◆ getDisabledPairsConst()

const std::set< std::pair< std::string, std::string > > & ACM::getDisabledPairsConst ( ) const

Get the pairs of frames that have collision disabled.

Returns
The set of pairs with collision disabled.

Definition at line 56 of file acm.cpp.

57 {
58  return acm_;
59 }

◆ getFilter()

std::shared_ptr< dart::collision::BodyNodeCollisionFilter > ACM::getFilter ( )

Get the Dart collision filter corresponding to this ACM.

Returns
The collision filter.

Definition at line 36 of file acm.cpp.

37 {
38  return filter_;
39 }

◆ getFilterConst()

const std::shared_ptr< dart::collision::BodyNodeCollisionFilter > & ACM::getFilterConst ( ) const

Get the Dart collision filter corresponding to this ACM.

Returns
The collision filter.

Definition at line 41 of file acm.cpp.

42 {
43  return filter_;
44 }

◆ getStructure()

const Structure * ACM::getStructure ( ) const

Get the structure this ACM is for.

Returns
The structure for the ACM.

Definition at line 46 of file acm.cpp.

47 {
48  return structure_;
49 }

◆ makeKey()

std::pair< std::string, std::string > ACM::makeKey ( const std::string a,
const std::string b 
) const
private

Create a unique key for two frame names.

Parameters
[in]aBody frame A.
[in]bBody frame B.
Returns
Key for disabled collision in ACM.

Definition at line 61 of file acm.cpp.

62 {
63  if (a < b)
64  return std::make_pair(a, b);
65 
66  return std::make_pair(b, a);
67 }
T make_pair(T... args)

Member Data Documentation

◆ acm_

std::set<std::pair<std::string, std::string> > robowflex::darts::ACM::acm_
private

Disabled collision pairs.

Definition at line 103 of file acm.h.

◆ filter_

std::shared_ptr<dart::collision::BodyNodeCollisionFilter> robowflex::darts::ACM::filter_
private

Collision filter.

Definition at line 104 of file acm.h.

◆ structure_

const Structure* robowflex::darts::ACM::structure_
private

Structure this ACM is for.

Definition at line 102 of file acm.h.


The documentation for this class was generated from the following files: