collision/broadphase-manager.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2022 INRIA
3 //
4 
5 #ifndef __pinocchio_collision_broadphase_manager_hpp__
6 #define __pinocchio_collision_broadphase_manager_hpp__
7 
9 
12 
13 namespace pinocchio
14 {
15 
16  template<typename _Manager>
17  struct BroadPhaseManagerTpl : public BroadPhaseManagerBase<BroadPhaseManagerTpl<_Manager>>
18  {
19  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
20 
22  typedef std::vector<CollisionObject> CollisionObjectVector;
23  typedef Eigen::VectorXd VectorXs;
24  typedef _Manager Manager;
25 
27  typedef ::pinocchio::GeometryModel GeometryModel;
28  typedef ::pinocchio::GeometryData GeometryData;
29 
31  BroadPhaseManagerTpl() // for std::vector
32  : Base()
33  {
34  }
35 
43  const Model * model_ptr,
48  {
50  selected_geometry_objects = filter.apply(geom_model.geometryObjects);
51 
55  for (size_t k = 0; k < selected_geometry_objects.size(); ++k)
56  {
57  const size_t geometry_id = selected_geometry_objects[k];
58  geometry_to_collision_index[geometry_id] = k;
59  collision_object_is_active[k] = !geom_model.geometryObjects[geometry_id].disableCollision;
60  }
61 
62  selected_collision_pairs.reserve(geom_model.collisionPairs.size());
63  for (size_t k = 0; k < geom_model.collisionPairs.size(); ++k)
64  {
65  const CollisionPair & pair = geom_model.collisionPairs[k];
66  if (
69  {
70  selected_collision_pairs.push_back(k);
71  }
72 
74  }
75 
77  static_cast<Eigen::DenseIndex>(selected_geometry_objects.size()));
78 
79  init();
80  }
81 
87  : Base(other)
93  {
94  init();
95  }
96 
97  using Base::getGeometryData;
98  using Base::getGeometryModel;
99  using Base::getModel;
100 
108  void update(bool compute_local_aabb = false);
109 
115  void update(GeometryData * geom_data_ptr_new);
116 
118 
121  bool check() const;
122 
124  bool check(CollisionCallBackBase * callback) const;
125 
128  {
129  return collision_objects;
130  }
133  {
134  return collision_objects;
135  }
136 
139  {
141  }
142 
145  bool collide(CollisionObject & obj, CollisionCallBackBase * callback) const;
146 
148  bool collide(CollisionCallBackBase * callback) const;
149 
151  bool collide(BroadPhaseManagerTpl & other_manager, CollisionCallBackBase * callback) const;
152 
153  // /// @brief Performs distance computation between one object and all the objects belonging to
154  // the manager void distance(CollisionObject* obj, DistanceCallBackBase * callback) const;
155 
156  // /// @brief Performs distance test for the objects belonging to the manager (i.e., N^2 self
157  // distance) void distance(DistanceCallBackBase * callback) const;
158 
159  // /// @brief Performs distance test with objects belonging to another manager
160  // void distance(BroadPhaseCollisionManager* other_manager, DistanceCallBackBase * callback)
161  // const;
162 
165  {
166  return manager;
167  }
168 
170  const Manager & getManager() const
171  {
172  return manager;
173  }
174 
176  const std::vector<bool> & getCollisionObjectStatus() const
177  {
179  }
180 
181  protected:
184 
187 
190 
192  std::vector<size_t> selected_geometry_objects;
193 
195  std::vector<size_t> geometry_to_collision_index;
196 
198  std::vector<size_t> selected_collision_pairs;
199 
201  std::vector<bool> collision_object_is_active;
202 
204  void init();
205 
206  }; // struct BroadPhaseManagerTpl<BroadPhaseManagerDerived>
207 
208 } // namespace pinocchio
209 
210 /* --- Details -------------------------------------------------------------------- */
211 #include "pinocchio/collision/broadphase-manager.hxx"
212 
213 #endif // ifndef __pinocchio_collision_broadphase_manager_hpp__
pinocchio::BroadPhaseManagerTpl::~BroadPhaseManagerTpl
~BroadPhaseManagerTpl()
pinocchio::BroadPhaseManagerTpl::BroadPhaseManagerTpl
BroadPhaseManagerTpl(const BroadPhaseManagerTpl &other)
Copy contructor.
Definition: collision/broadphase-manager.hpp:86
pinocchio::GeometryObjectFilterBase
Definition: geometry-object-filter.hpp:13
pinocchio::BroadPhaseManagerBase
Definition: collision/broadphase-manager-base.hpp:15
pinocchio::BroadPhaseManagerTpl::collide
bool collide(CollisionObject &obj, CollisionCallBackBase *callback) const
Performs collision test between one object and all the objects belonging to the manager.
CollisionObject
CollisionObject(const shared_ptr< CollisionGeometry > &cgeom_, bool compute_local_aabb=true)
pinocchio::BroadPhaseManagerTpl::selected_geometry_objects
std::vector< size_t > selected_geometry_objects
Selected geometry objects in the original geometry_model.
Definition: collision/broadphase-manager.hpp:192
pinocchio::BroadPhaseManagerTpl::GeometryData
::pinocchio::GeometryData GeometryData
Definition: collision/broadphase-manager.hpp:28
pinocchio::BroadPhaseManagerTpl::Model
::pinocchio::Model Model
Definition: collision/broadphase-manager.hpp:26
pinocchio::BroadPhaseManagerTpl::getCollisionObjects
CollisionObjectVector & getCollisionObjects()
Returns the vector of collision objects associated to the manager.
Definition: collision/broadphase-manager.hpp:132
broadphase_collision_manager.h
pinocchio::BroadPhaseManagerBase< BroadPhaseManagerTpl< _Manager > >::geometry_model_ptr
const GeometryModel * geometry_model_ptr
Pointer to the geometry model.
Definition: collision/broadphase-manager-base.hpp:155
pinocchio::GeometryData
Definition: multibody/geometry.hpp:233
pinocchio::python::context::Model
ModelTpl< Scalar, Options > Model
Definition: bindings/python/context/generic.hpp:63
pinocchio::CollisionCallBackBase
Interface for Pinocchio collision callback functors.
Definition: broadphase-callbacks.hpp:19
pinocchio::BroadPhaseManagerTpl::VectorXs
Eigen::VectorXd VectorXs
Definition: collision/broadphase-manager.hpp:23
pinocchio::GeometryModel::geometryObjects
GeometryObjectVector geometryObjects
Vector of GeometryObjects used for collision computations.
Definition: multibody/geometry.hpp:217
pinocchio::BroadPhaseManagerTpl::Manager
_Manager Manager
Definition: collision/broadphase-manager.hpp:24
geometry-object-filter.hpp
pinocchio::BroadPhaseManagerTpl::getCollisionObjectStatus
const std::vector< bool > & getCollisionObjectStatus() const
Returns the status of the collision object.
Definition: collision/broadphase-manager.hpp:176
pinocchio::BroadPhaseManagerTpl::check
bool check() const
Check whether the base broad phase manager is aligned with the current collision_objects.
pinocchio::BroadPhaseManagerTpl::init
void init()
Initialialisation of BroadPhaseManagerTpl.
pinocchio::CollisionPair
Definition: multibody/geometry.hpp:21
pinocchio::BroadPhaseManagerTpl::selected_collision_pairs
std::vector< size_t > selected_collision_pairs
Selected collision pairs in the original geometry_model.
Definition: collision/broadphase-manager.hpp:198
pinocchio::BroadPhaseManagerBase< BroadPhaseManagerTpl< _Manager > >::geometry_data_ptr
GeometryData * geometry_data_ptr
Pointer to the geometry data.
Definition: collision/broadphase-manager-base.hpp:158
pinocchio::BroadPhaseManagerTpl::BroadPhaseManagerTpl
BroadPhaseManagerTpl(const Model *model_ptr, const GeometryModel *geometry_model_ptr, GeometryData *geometry_data_ptr, const GeometryObjectFilterBase &filter=GeometryObjectFilterNothing())
Constructor from a given geometry model and data.
Definition: collision/broadphase-manager.hpp:42
pinocchio::BroadPhaseManagerTpl::Base
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef BroadPhaseManagerBase< BroadPhaseManagerTpl< _Manager > > Base
Definition: collision/broadphase-manager.hpp:21
pinocchio::BroadPhaseManagerTpl::BroadPhaseManagerTpl
BroadPhaseManagerTpl()
Default constructor.
Definition: collision/broadphase-manager.hpp:31
pinocchio::BroadPhaseManagerTpl::getManager
Manager & getManager()
Returns internal manager.
Definition: collision/broadphase-manager.hpp:164
size
FCL_REAL size() const
pinocchio::BroadPhaseManagerTpl::GeometryModel
::pinocchio::GeometryModel GeometryModel
Definition: collision/broadphase-manager.hpp:27
pinocchio::BroadPhaseManagerTpl::collision_object_inflation
VectorXs collision_object_inflation
the inflation value related to each collision object.
Definition: collision/broadphase-manager.hpp:189
pinocchio::BroadPhaseManagerTpl::collision_objects
CollisionObjectVector collision_objects
the vector of collision objects.
Definition: collision/broadphase-manager.hpp:186
append-urdf-model-with-another-model.geom_model
geom_model
Definition: append-urdf-model-with-another-model.py:26
pinocchio::BroadPhaseManagerTpl::manager
Manager manager
internal manager
Definition: collision/broadphase-manager.hpp:183
pinocchio::BroadPhaseManagerTpl::update
void update(bool compute_local_aabb=false)
Update the manager from the current geometry positions and update the underlying FCL broad phase mana...
pinocchio::BroadPhaseManagerTpl::getCollisionObjectInflation
const VectorXs & getCollisionObjectInflation()
Returns the inflation value related to each collision object.
Definition: collision/broadphase-manager.hpp:138
pinocchio::BroadPhaseManagerTpl::collision_object_is_active
std::vector< bool > collision_object_is_active
Disable status related to each collision objects.
Definition: collision/broadphase-manager.hpp:201
broadphase-manager-base.hpp
pinocchio::BroadPhaseManagerTpl::getCollisionObjects
const CollisionObjectVector & getCollisionObjects() const
Returns the vector of collision objects associated to the manager.
Definition: collision/broadphase-manager.hpp:127
pinocchio::GeometryModel
Definition: multibody/geometry.hpp:50
pinocchio::BroadPhaseManagerTpl::getManager
const Manager & getManager() const
Returns internal manager.
Definition: collision/broadphase-manager.hpp:170
pinocchio::BroadPhaseManagerBase< BroadPhaseManagerTpl< _Manager > >::model_ptr
const Model * model_ptr
Pointer to the model.
Definition: collision/broadphase-manager-base.hpp:152
Base
pinocchio::ModelTpl
Definition: context/generic.hpp:20
pinocchio::BroadPhaseManagerTpl::CollisionObjectVector
std::vector< CollisionObject > CollisionObjectVector
Definition: collision/broadphase-manager.hpp:22
CppAD::max
AD< Scalar > max(const AD< Scalar > &x, const AD< Scalar > &y)
Definition: autodiff/cppad.hpp:181
pinocchio::BroadPhaseManagerTpl
Definition: collision/broadphase-manager.hpp:17
pinocchio::GeometryObjectFilterNothing
Definition: geometry-object-filter.hpp:18
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::BroadPhaseManagerTpl::geometry_to_collision_index
std::vector< size_t > geometry_to_collision_index
Mapping between a given geometry index and a collision index.
Definition: collision/broadphase-manager.hpp:195


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:06