pinocchio  3.3.1
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
tree-broadphase-manager.hpp
1 //
2 // Copyright (c) 2022 INRIA
3 //
4 
5 #ifndef __pinocchio_collision_tree_broadphase_manager_hpp__
6 #define __pinocchio_collision_tree_broadphase_manager_hpp__
7 
8 #include "pinocchio/collision/broadphase-manager.hpp"
9 
10 namespace pinocchio
11 {
12 
13  template<typename _Manager>
14  struct TreeBroadPhaseManagerTpl : public BroadPhaseManagerBase<TreeBroadPhaseManagerTpl<_Manager>>
15  {
16  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
17 
18  typedef _Manager Manager;
21 
22  typedef std::vector<hpp::fcl::CollisionObject *> CollisionObjectPointerVector;
23  typedef std::vector<BroadPhaseManager> BroadPhaseManagerVector;
24 
25  typedef typename BroadPhaseManager::Model Model;
28 
30  TreeBroadPhaseManagerTpl() // for std::vector
31  : Base()
32  {
33  }
34 
42  const Model * model_ptr,
46  {
47  init(static_cast<size_t>(model_ptr->njoints));
48  }
49 
55  : Base(other)
56  {
57  init(other.managers.size());
58  }
59 
62  using Base::getModel;
63 
71  void update(bool compute_local_aabb = false);
72 
78  void update(GeometryData * geom_data_ptr_new);
79 
81  {
82  }
83 
86  bool check() const;
87 
89  bool check(CollisionCallBackBase * callback) const;
90 
93  bool collide(CollisionObject & obj, CollisionCallBackBase * callback) const;
94 
96  bool collide(CollisionCallBackBase * callback) const;
97 
99  bool collide(TreeBroadPhaseManagerTpl & other_manager, CollisionCallBackBase * callback) const;
100 
101  // /// @brief Performs distance computation between one object and all the objects belonging to
102  // the manager void distance(CollisionObject* obj, DistanceCallBackBase * callback) const;
103 
104  // /// @brief Performs distance test for the objects belonging to the manager (i.e., N^2 self
105  // distance) void distance(DistanceCallBackBase * callback) const;
106 
107  // /// @brief Performs distance test with objects belonging to another manager
108  // void distance(TreeBroadPhaseManagerTpl* other_manager, DistanceCallBackBase * callback)
109  // const;
110 
112  const BroadPhaseManagerVector & getBroadPhaseManagers() const
113  {
114  return managers;
115  }
116 
118  BroadPhaseManagerVector & getBroadPhaseManagers()
119  {
120  return managers;
121  }
122 
123  protected:
125  BroadPhaseManagerVector managers;
126 
128  void init(const size_t njoints);
129 
130  }; // struct BroadPhaseManagerTpl<BroadPhaseManagerDerived>
131 
132 } // namespace pinocchio
133 
134 /* --- Details -------------------------------------------------------------------- */
135 #include "pinocchio/collision/tree-broadphase-manager.hxx"
136 
137 #endif // ifndef __pinocchio_collision_tree_broadphase_manager_hpp__
Main pinocchio namespace.
Definition: treeview.dox:11
const GeometryModel & getGeometryModel() const
Returns the geometry model associated to the manager.
const Model & getModel() const
Returns the model associated to the manager.
const GeometryModel * geometry_model_ptr
Pointer to the geometry model.
const GeometryData & getGeometryData() const
Returns the geometry data associated to the manager.
Interface for Pinocchio collision callback functors.
int njoints
Number of joints.
Definition: model.hpp:104
void update(GeometryData *geom_data_ptr_new)
Update the manager with a new geometry data.
bool collide(CollisionObject &obj, CollisionCallBackBase *callback) const
Performs collision test between one object and all the objects belonging to the manager.
void init(const size_t njoints)
Initialialisation.
TreeBroadPhaseManagerTpl(const TreeBroadPhaseManagerTpl &other)
Copy contructor.
bool check() const
Check whether the base broad phase manager is aligned with the current collision_objects.
bool check(CollisionCallBackBase *callback) const
Check whether the callback is inline with *this.
BroadPhaseManagerVector managers
the vector of collision objects.
const BroadPhaseManagerVector & getBroadPhaseManagers() const
Returns internal broad phase managers.
TreeBroadPhaseManagerTpl(const Model *model_ptr, const GeometryModel *geometry_model_ptr, GeometryData *geometry_data_ptr)
Constructor from a given geometry model and data.
bool collide(TreeBroadPhaseManagerTpl &other_manager, CollisionCallBackBase *callback) const
Performs collision test with objects belonging to another manager.
BroadPhaseManagerVector & getBroadPhaseManagers()
Returns internal broad phase managers.
void update(bool compute_local_aabb=false)
Update the manager from the current geometry positions and update the underlying FCL broad phase mana...
bool collide(CollisionCallBackBase *callback) const
Performs collision test for the objects belonging to the manager.