5 #ifndef __pinocchio_collision_broadphase_callback_hpp__
6 #define __pinocchio_collision_broadphase_callback_hpp__
8 #include <hpp/fcl/broadphase/broadphase_callbacks.h>
10 #include "pinocchio/multibody/fcl.hpp"
11 #include "pinocchio/multibody/geometry.hpp"
13 #include "pinocchio/collision/collision.hpp"
44 virtual bool stop()
const = 0;
90 bool collide(hpp::fcl::CollisionObject * o1, hpp::fcl::CollisionObject * o2)
93 assert(!
stop() &&
"must never happened");
103 PINOCCHIO_CHECK_INPUT_ARGUMENT(
104 go1_index < (Eigen::DenseIndex)geometry_model.
ngeoms && go1_index >= 0);
105 PINOCCHIO_CHECK_INPUT_ARGUMENT(
106 go2_index < (Eigen::DenseIndex)geometry_model.
ngeoms && go2_index >= 0);
109 if (pair_index == -1)
114 const bool do_collision_check =
119 if (!do_collision_check)
124 fcl::CollisionRequest collision_request(
126 collision_request.gjk_variant = fcl::GJKVariant::NesterovAcceleration;
130 co1.collisionGeometry().get()
132 || co2.collisionGeometry().get()
134 PINOCCHIO_THROW_PRETTY(
135 std::logic_error,
"go1: " << go1_index <<
" or go2: " << go2_index
136 <<
" have not been updated and have missmatching pointers.");
149 catch (std::logic_error & e)
151 PINOCCHIO_THROW_PRETTY(
152 std::logic_error,
"Geometries with index go1: "
153 << go1_index <<
" or go2: " << go2_index
154 <<
" have produced an internal error within HPP-FCL.\n what:\n"
199 #include "pinocchio/collision/broadphase-callbacks.hxx"
Main pinocchio namespace.
bool computeCollision(const GeometryModel &geom_model, GeometryData &geom_data, const PairIndex pair_id, fcl::CollisionRequest &collision_request)
Compute the collision status between a SINGLE collision pair. The result is store in the collisionRes...
Interface for Pinocchio collision callback functors.
bool accumulate
Whether the callback is used in an accumulate mode where several collide methods are called successiv...
virtual void done()
Callback method called after the termination of a collisition detection algorithm....
const GeometryModel * geometry_model_ptr
Geometry model associated to the callback.
GeometryData * geometry_data_ptr
Geometry data associated to the callback.
virtual bool stop() const =0
If true, the stopping criteria related to the collision callback has been met and one can stop.
bool collision
Whether there is a collision or not.
bool stopAtFirstCollision
Whether to stop or not when localizing a first collision.
PairIndex collisionPairIndex
The collision index of the first pair in collision.
void done() final
Callback method called after the termination of a collisition detection algorithm....
size_t count
Number of visits of the collide method.
bool stop() const final
If true, the stopping criteria related to the collision callback has been met and one can stop.
size_t geometryObjectIndex
Geometry object index related to the current collision object.
std::vector< fcl::CollisionRequest > collisionRequests
Defines what information should be computed by collision test. There is one request per pair of geome...
PairIndex collisionPairIndex
Index of the collision pair.
std::vector< bool > activeCollisionPairs
Vector of collision pairs.
GeometryObjectVector geometryObjects
Vector of GeometryObjects used for collision computations.
MatrixXi collisionPairMapping
Matrix relating the collision pair ID to a pair of two GeometryObject indexes.
Index ngeoms
The number of GeometryObjects.
CollisionPairVector collisionPairs
Vector of collision pairs.