37 #ifndef MOVEIT_COLLISION_DETECTION_FCL_COLLISION_COMMON_ 38 #define MOVEIT_COLLISION_DETECTION_FCL_COLLISION_COMMON_ 43 #include <fcl/broadphase/broadphase.h> 44 #include <fcl/collision.h> 45 #include <fcl/distance.h> 71 const std::string&
getID()
const 76 return ptr.link->getName();
78 return ptr.ab->getName();
92 return "Robot attached";
118 CollisionData() : req_(NULL), active_components_only_(NULL), res_(NULL), acm_(NULL), done_(false)
123 : req_(req), active_components_only_(NULL), res_(res), acm_(acm), done_(false)
132 void enableGroup(
const robot_model::RobotModelConstPtr& kmodel);
180 : collision_geometry_(collision_geometry), collision_geometry_data_(new
CollisionGeometryData(link, shape_index))
182 collision_geometry_->setUserData(collision_geometry_data_.get());
186 : collision_geometry_(collision_geometry), collision_geometry_data_(new
CollisionGeometryData(ab, shape_index))
188 collision_geometry_->setUserData(collision_geometry_data_.get());
192 : collision_geometry_(collision_geometry), collision_geometry_data_(new
CollisionGeometryData(obj, shape_index))
194 collision_geometry_->setUserData(collision_geometry_data_.get());
197 template <
typename T>
200 if (!newType && collision_geometry_data_)
201 if (collision_geometry_data_->ptr.raw == reinterpret_cast<const void*>(data))
204 collision_geometry_->setUserData(collision_geometry_data_.get());
216 void registerTo(fcl::BroadPhaseCollisionManager* manager);
217 void unregisterFrom(fcl::BroadPhaseCollisionManager* manager);
227 std::shared_ptr<fcl::BroadPhaseCollisionManager>
manager_;
230 bool collisionCallback(fcl::CollisionObject* o1, fcl::CollisionObject* o2,
void* data);
232 bool distanceCallback(fcl::CollisionObject* o1, fcl::CollisionObject* o2,
void* data,
double& min_dist);
250 Eigen::Quaterniond q(b.linear());
251 f.setTranslation(fcl::Vec3f(b.translation().x(), b.translation().y(), b.translation().z()));
252 f.setQuatRotation(fcl::Quaternion3f(q.w(), q.x(), q.y(), q.z()));
264 c.
pos = Eigen::Vector3d(fc.pos[0], fc.pos[1], fc.pos[2]);
265 c.
normal = Eigen::Vector3d(fc.normal[0], fc.normal[1], fc.normal[2]);
266 c.
depth = fc.penetration_depth;
285 cs.
cost = fcs.cost_density;
bool sameObject(const CollisionGeometryData &other) const
Check if two CollisionGeometryData objects point to the same source object.
Representation of a collision checking request.
CollisionGeometryData(const World::Object *obj, int index)
const CollisionRequest * req_
The collision request passed by the user.
CollisionResult * res_
The user specified response location.
double cost
The partial cost (the probability of existance for the object there is a collision with) ...
Type
The types of bodies that are considered for collision.
bool done_
Flag indicating whether collision checking is complete.
boost::array< double, 3 > aabb_min
The minimum bound of the AABB defining the volume responsible for this partial cost.
const World::Object * obj
FCLGeometryConstPtr createCollisionGeometry(const shapes::ShapeConstPtr &shape, const robot_model::LinkModel *link, int shape_index)
CollisionGeometryData(const robot_model::LinkModel *link, int index)
union collision_detection::CollisionGeometryData::@0 ptr
void updateCollisionGeometryData(const T *data, int shape_index, bool newType)
bool collisionCallback(fcl::CollisionObject *o1, fcl::CollisionObject *o2, void *data)
A body attached to a robot link.
FCLGeometry(fcl::CollisionGeometry *collision_geometry, const robot_state::AttachedBody *ab, int shape_index)
Representation of a collision checking result.
DistanceData(const DistanceRequest *req, DistanceResult *res)
Generic interface to collision detection.
FCLGeometry(fcl::CollisionGeometry *collision_geometry, const robot_model::LinkModel *link, int shape_index)
std::shared_ptr< fcl::BroadPhaseCollisionManager > manager_
void fcl2contact(const fcl::Contact &fc, Contact &c)
CollisionGeometryDataPtr collision_geometry_data_
A representation of an object.
MOVEIT_STRUCT_FORWARD(CollisionGeometryData)
CollisionData(const CollisionRequest *req, CollisionResult *res, const AllowedCollisionMatrix *acm)
boost::array< double, 3 > aabb_max
The maximum bound of the AABB defining the volume responsible for this partial cost.
Definition of a structure for the allowed collision matrix. All elements in the collision world are r...
void cleanCollisionGeometryCache()
std::vector< FCLGeometryConstPtr > collision_geometry_
std::string getTypeString() const
CollisionGeometryData(const robot_state::AttachedBody *ab, int index)
std::vector< FCLCollisionObjectPtr > collision_objects_
std::shared_ptr< const fcl::CollisionObject > FCLCollisionObjectConstPtr
const AllowedCollisionMatrix * acm_
The user specified collision matrix (may be NULL)
void fcl2costsource(const fcl::CostSource &fcs, CostSource &cs)
DistanceResult * res
Distance query results information.
const std::string & getID() const
A body in the environment.
void transform2fcl(const Eigen::Affine3d &b, fcl::Transform3f &f)
std::shared_ptr< fcl::CollisionGeometry > collision_geometry_
A link from the robot. Contains the constant transform applied to the link and its geometry...
FCLGeometry(fcl::CollisionGeometry *collision_geometry, const World::Object *obj, int shape_index)
bool done
Indicates if distance query is finished.
When collision costs are computed, this structure contains information about the partial cost incurre...
bool distanceCallback(fcl::CollisionObject *o1, fcl::CollisionObject *o2, void *data, double &min_dist)
Object defining bodies that can be attached to robot links. This is useful when handling objects pick...
std::shared_ptr< fcl::CollisionObject > FCLCollisionObjectPtr
const robot_state::AttachedBody * ab
const DistanceRequest * req
Distance query request information.
const std::set< const robot_model::LinkModel * > * active_components_only_
const robot_model::LinkModel * link
std::shared_ptr< const Shape > ShapeConstPtr