18 #ifndef __se3_algo_geometry_hxx__ 19 #define __se3_algo_geometry_hxx__ 21 #include <boost/foreach.hpp> 32 const Eigen::VectorXd & q
35 assert(model.
check(data) &&
"data is not consistent with model.");
47 assert(model.
check(data) &&
"data is not consistent with model.");
49 for (GeomIndex i=0; i < (GeomIndex) geomModel.
ngeoms; ++i)
51 const Model::JointIndex & joint = geomModel.
geometryObjects[i].parentJoint;
56 #endif // WITH_HPP_FCL 67 const PairIndex& pairId)
77 collisionResult.clear();
83 return collisionResult.isCollision();
88 const bool stopAtFirstCollision =
true)
90 bool isColliding =
false;
92 for (std::size_t cpt = 0; cpt < geomModel.
collisionPairs.size(); ++cpt)
98 if(isColliding && stopAtFirstCollision)
111 const Eigen::VectorXd & q,
112 const bool stopAtFirstCollision
115 assert(model.
check(data) &&
"data is not consistent with model.");
128 const PairIndex & pairId )
147 template <
bool COMPUTE_SHORTEST>
152 double min_dist = std::numeric_limits<double>::infinity();
153 for (std::size_t cpt = 0; cpt < geomModel.
collisionPairs.size(); ++cpt)
158 if (COMPUTE_SHORTEST && geomData.
distanceResults[cpt].min_distance < min_dist)
172 return computeDistances<true>(geomModel,geomData);
180 const Eigen::VectorXd & q
183 return computeDistances<true>(model, data, geomModel, geomData, q);
186 template <
bool ComputeShortest>
191 const Eigen::VectorXd & q
194 assert(model.
check(data) &&
"data is not consistent with model.");
196 return computeDistances<ComputeShortest>(geomModel,geomData);
205 #define SE3_GEOM_AABB(FCL,p1,p2,p3) \ 207 FCL->aabb_local.p1##_ [0], \ 208 FCL->aabb_local.p2##_ [1], \ 209 FCL->aabb_local.p3##_ [2]) 221 const boost::shared_ptr<const fcl::CollisionGeometry> & fcl
225 assert (i<geomData.
radius.size());
227 double radius = geomData.
radius[i] * geomData.
radius[i];
231 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,min,min,min)).squaredNorm(),radius);
232 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,min,min,max)).squaredNorm(),radius);
233 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,min,max,min)).squaredNorm(),radius);
234 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,min,max,max)).squaredNorm(),radius);
235 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,max,min,min)).squaredNorm(),radius);
236 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,max,min,max)).squaredNorm(),radius);
237 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,max,max,min)).squaredNorm(),radius);
238 radius = std::max (jMb.
act(SE3_GEOM_AABB(fcl,max,max,max)).squaredNorm(),radius);
241 geomData.
radius[i] = sqrt(radius);
246 #endif // WITH_HPP_FCL 263 geomModel1.
ngeoms += nGeom2;
266 geomModel1.
collisionPairs.reserve(nColPairs1 + nColPairs2 + nGeom1 * nGeom2);
267 for (Index i = 0; i < nColPairs2; ++i)
276 for (Index i = 0; i < nGeom1; ++i) {
277 for (Index j = 0; j < nGeom2; ++j) {
285 #endif // ifnded __se3_algo_geometry_hxx__ JointIndex parentJoint
Index of the parent joint.
container::aligned_vector< GeometryObject > geometryObjects
Vector of GeometryObjects used for collision computations.
boost::shared_ptr< fcl::CollisionGeometry > fcl
The actual cloud of points representing the collision mesh of the object after scaling.
std::vector< bool > activeCollisionPairs
Vector of collision pairs.
fcl::CollisionRequest collisionRequest
Defines what information should be computed by collision test.
JointModelVector joints
Model of joint i, encapsulated in a JointModelAccessor.
std::size_t computeDistances(const Model &model, Data &data, const GeometryModel &geomModel, GeometryData &geomData, const Eigen::VectorXd &q)
std::vector< fcl::CollisionResult > collisionResults
Vector gathering the result of the collision computation for all the collision pairs.
SE3 placement
Position of geometry object in parent joint frame.
std::vector< CollisionPair > collisionPairs
Vector of collision pairs.
void appendGeometryModel(GeometryModel &geomModel1, GeometryData &geomData1)
std::vector< fcl::DistanceResult > distanceResults
Vector gathering the result of the distance computation for all the collision pairs.
fcl::DistanceResult & computeDistance(const GeometryModel &geomModel, GeometryData &geomData, const PairIndex &pairId)
Compute the minimal distance between collision objects of a SINGLE collison pair. ...
fcl::DistanceRequest distanceRequest
Defines what information should be computed by distance computation.
std::vector< fcl::CollisionObject > collisionObjects
Collision objects (ie a fcl placed geometry).
void computeBodyRadius(const Model &model, const GeometryModel &geomModel, GeometryData &geomData)
bool computeCollision(const GeometryModel &geomModel, GeometryData &geomData, const PairIndex &pairId)
Compute the collision status between a SINGLE collision pair. The result is store in the collisionRes...
EIGEN_MAKE_ALIGNED_OPERATOR_NEW Index ngeoms
The number of GeometryObjects.
std::vector< double > radius
Radius of the bodies, i.e. distance of the further point of the geometry model attached to the body f...
void forwardKinematics(const Model &model, Data &data, const Eigen::VectorXd &q)
Update the joint placements according to the current joint configuration.
container::aligned_vector< SE3 > oMi
Vector of absolute joint placements (wrt the world).
EIGEN_MAKE_ALIGNED_OPERATOR_NEW container::aligned_vector< se3::SE3 > oMg
Vector gathering the SE3 placements of the geometry objects relative to the world. See updateGeometryPlacements to update the placements.
bool check(const AlgorithmCheckerBase< D > &checker=AlgorithmCheckerBase< D >()) const
internal::SE3GroupAction< D >::ReturnType act(const D &d) const
ay = aXb.act(by)
bool computeCollisions(const Model &model, Data &data, const GeometryModel &geomModel, GeometryData &geomData, const Eigen::VectorXd &q, const bool stopAtFirstCollision=false)
void updateGeometryPlacements(const Model &model, Data &data, const GeometryModel &geomModel, GeometryData &geomData, const Eigen::VectorXd &q)
Apply a forward kinematics and update the placement of the geometry objects.