Robowflex  v0.1
Making MoveIt Easy
acm.h
Go to the documentation of this file.
1 /* Author: Zachary Kingston */
2 
3 #ifndef ROBOWFLEX_DART_ACM_
4 #define ROBOWFLEX_DART_ACM_
5 
6 #include <set>
7 
8 #include <dart/dynamics/BodyNode.hpp>
9 #include <dart/collision/CollisionFilter.hpp>
10 
12 
13 namespace robowflex
14 {
15  namespace darts
16  {
17  /** \cond IGNORE */
19  /** \endcond */
20 
21  /** \cond IGNORE */
23  /** \endcond */
24 
25  /** \class robowflex::darts::ACMPtr
26  \brief A shared pointer wrapper for robowflex::darts::ACM. */
27 
28  /** \class robowflex::darts::ACMConstPtr
29  \brief A const shared pointer wrapper for robowflex::darts::ACM. */
30 
31  /** \brief Allowable collision matrix for robowflex::darts::Structure.
32  */
33  class ACM
34  {
35  public:
36  /** \brief Constructor.
37  * \param[in] structure The structure the ACM is for.
38  */
39  ACM(const Structure *structure);
40 
41  /** \name Enabling / Disabling Collisions
42  \{ */
43 
44  /** \brief Disable collisions between body frames \a a and \a b.
45  * \param[in] a Body frame A.
46  * \param[in] b Body frame B.
47  */
48  void disableCollision(const std::string &a, const std::string &b);
49 
50  /** \brief Enable collisions between body frames \a a and \a b.
51  * \param[in] a Body frame A.
52  * \param[in] b Body frame B.
53  */
54  void enableCollision(const std::string &a, const std::string &b);
55 
56  /** \} */
57 
58  /** \name ACM Information
59  \{ */
60 
61  /** \brief Get the pairs of frames that have collision disabled.
62  * \return The set of pairs with collision disabled.
63  */
65 
66  /** \brief Get the pairs of frames that have collision disabled.
67  * \return The set of pairs with collision disabled.
68  */
69  const std::set<std::pair<std::string, std::string>> &getDisabledPairsConst() const;
70 
71  /** \brief Get the Dart collision filter corresponding to this ACM.
72  * \return The collision filter.
73  */
75 
76  /** \brief Get the Dart collision filter corresponding to this ACM.
77  * \return The collision filter.
78  */
80 
81  /** \} */
82 
83  /** \brief Get the structure this ACM is for.
84  * \return The structure for the ACM.
85  */
86  const Structure *getStructure() const;
87 
88  private:
89  /** \brief Create a unique key for two frame names.
90  * \param[in] a Body frame A.
91  * \param[in] b Body frame B.
92  * \return Key for disabled collision in ACM.
93  */
94  std::pair<std::string, std::string> makeKey(const std::string &a, const std::string &b) const;
95 
96  /** \brief Get the body node in the structure corresponding to the body frame name.
97  * \param[in] key Name of body frame.
98  * \return Body frame in structure.
99  */
100  dart::dynamics::BodyNode *getBodyNode(const std::string &key);
101 
102  const Structure *structure_; ///< Structure this ACM is for.
103  std::set<std::pair<std::string, std::string>> acm_; ///< Disabled collision pairs.
105  };
106 
107  } // namespace darts
108 } // namespace robowflex
109 
110 #endif
#define ROBOWFLEX_CLASS_FORWARD(C)
Macro that forward declares a class and defines two shared ptrs types:
Definition: class_forward.h:16
Allowable collision matrix for robowflex::darts::Structure.
Definition: acm.h:34
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
std::set< std::pair< std::string, std::string > > acm_
Disabled collision pairs.
Definition: acm.h:103
Wrapper class for a dart::dynamics::Skeleton.
Definition: structure.h:53
Main namespace. Contains all library classes and functions.
Definition: scene.cpp:25