GCC Code Coverage Report


Directory: ./
File: include/pinocchio/collision/tree-broadphase-manager.hpp
Date: 2024-08-27 18:20:05
Exec Total Coverage
Lines: 0 9 0.0%
Branches: 0 4 0.0%

Line Branch Exec Source
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;
19 typedef BroadPhaseManagerBase<TreeBroadPhaseManagerTpl<_Manager>> Base;
20 typedef BroadPhaseManagerTpl<Manager> BroadPhaseManager;
21
22 typedef std::vector<hpp::fcl::CollisionObject *> CollisionObjectPointerVector;
23 typedef std::vector<BroadPhaseManager> BroadPhaseManagerVector;
24
25 typedef typename BroadPhaseManager::Model Model;
26 typedef typename BroadPhaseManager::GeometryModel GeometryModel;
27 typedef typename BroadPhaseManager::GeometryData GeometryData;
28
29 /// @brief Default constructor.
30 TreeBroadPhaseManagerTpl() // for std::vector
31 : Base()
32 {
33 }
34
35 /// @brief Constructor from a given geometry model and data.
36 ///
37 /// \param[in] model_ptr pointer to the model of the kinematic tree.
38 /// \param[in] geometry_model_ptr pointer to the geometry model.
39 /// \param[in] geometry_data_ptr pointer to the geometry data.
40 ///
41 TreeBroadPhaseManagerTpl(
42 const Model * model_ptr,
43 const GeometryModel * geometry_model_ptr,
44 GeometryData * geometry_data_ptr)
45 : Base(model_ptr, geometry_model_ptr, geometry_data_ptr)
46 {
47 init(static_cast<size_t>(model_ptr->njoints));
48 }
49
50 /// @brief Copy contructor.
51 ///
52 /// \param[in] other manager to copy.
53 ///
54 TreeBroadPhaseManagerTpl(const TreeBroadPhaseManagerTpl & other)
55 : Base(other)
56 {
57 init(other.managers.size());
58 }
59
60 using Base::getGeometryData;
61 using Base::getGeometryModel;
62 using Base::getModel;
63
64 ///
65 /// @brief Update the manager from the current geometry positions and update the underlying FCL
66 /// broad phase manager.
67 ///
68 /// @param[in] compute_local_aabb whether to recompute the local AABB of the collision
69 /// geometries which have changed.
70 ///
71 void update(bool compute_local_aabb = false);
72
73 ///
74 /// @brief Update the manager with a new geometry data.
75 ///
76 /// \param[in] geom_data_ptr_new pointer to the new geometry data.
77 ///
78 void update(GeometryData * geom_data_ptr_new);
79
80 ~TreeBroadPhaseManagerTpl()
81 {
82 }
83
84 /// @brief Check whether the base broad phase manager is aligned with the current
85 /// collision_objects.
86 bool check() const;
87
88 /// @brief Check whether the callback is inline with *this
89 bool check(CollisionCallBackBase * callback) const;
90
91 /// @brief Performs collision test between one object and all the objects belonging to the
92 /// manager.
93 bool collide(CollisionObject & obj, CollisionCallBackBase * callback) const;
94
95 /// @brief Performs collision test for the objects belonging to the manager.
96 bool collide(CollisionCallBackBase * callback) const;
97
98 /// @brief Performs collision test with objects belonging to another manager.
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
111 /// @brief Returns internal broad phase managers.
112 const BroadPhaseManagerVector & getBroadPhaseManagers() const
113 {
114 return managers;
115 }
116
117 /// @brief Returns internal broad phase managers.
118 BroadPhaseManagerVector & getBroadPhaseManagers()
119 {
120 return managers;
121 }
122
123 protected:
124 /// @brief the vector of collision objects.
125 BroadPhaseManagerVector managers;
126
127 /// @brief Initialialisation
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__
138