42#ifndef TESSERACT_COLLISION_FCL_UTILS_H
43#define TESSERACT_COLLISION_FCL_UTILS_H
47#include <fcl/broadphase/broadphase_dynamic_AABB_tree-inl.h>
48#include <fcl/narrowphase/collision-inl.h>
49#include <fcl/narrowphase/distance-inl.h>
52#include <console_bridge/console.h>
81 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
83 using Ptr = std::shared_ptr<CollisionObjectWrapper>;
84 using ConstPtr = std::shared_ptr<const CollisionObjectWrapper>;
107 [](
const Eigen::Isometry3d& t1,
const Eigen::Isometry3d& t2) { return t1.isApprox(t2); });
138 std::shared_ptr<CollisionObjectWrapper>
clone()
const
140 auto clone_cow = std::make_shared<CollisionObjectWrapper>();
141 clone_cow->name_ =
name_;
151 assert(std::dynamic_pointer_cast<FCLCollisionObjectWrapper>(co) !=
nullptr);
153 std::make_shared<FCLCollisionObjectWrapper>(*std::static_pointer_cast<FCLCollisionObjectWrapper>(co));
154 collObj->setUserData(clone_cow.get());
155 collObj->setTransform(co->getTransform());
156 collObj->updateAABB();
157 clone_cow->collision_objects_.push_back(collObj);
158 clone_cow->collision_objects_raw_.push_back(collObj.get());
204 if (shapes.empty() || shape_poses.empty() || (shapes.size() != shape_poses.size()))
206 CONSOLE_BRIDGE_logDebug(
"ignoring link %s",
name.c_str());
210 auto new_cow = std::make_shared<COW>(
name,
type_id, shapes, shape_poses);
212 new_cow->m_enabled = enabled;
213 CONSOLE_BRIDGE_logDebug(
"Created collision object for link %s", new_cow->getName().c_str());
226 const std::unique_ptr<fcl::BroadPhaseCollisionManagerd>& static_manager,
227 const std::unique_ptr<fcl::BroadPhaseCollisionManagerd>& dynamic_manager)
235 std::vector<CollisionObjectPtr>& objects = cow->getCollisionObjects();
237 for (
auto& co : objects)
238 dynamic_manager->unregisterObject(co.get());
240 for (
auto& co : objects)
241 static_manager->registerObject(co.get());
249 std::vector<CollisionObjectPtr>& objects = cow->getCollisionObjects();
251 for (
auto& co : objects)
252 static_manager->unregisterObject(co.get());
254 for (
auto& co : objects)
255 dynamic_manager->registerObject(co.get());
This is a Tesseract link collision object wrapper which add items specific to tesseract....
Definition: fcl_utils.h:79
CollisionObjectWrapper()=default
std::shared_ptr< const CollisionObjectWrapper > ConstPtr
Definition: fcl_utils.h:84
short int m_collisionFilterGroup
Definition: fcl_utils.h:92
CollisionShapesConst shapes_
Definition: fcl_utils.h:178
std::shared_ptr< CollisionObjectWrapper > clone() const
Definition: fcl_utils.h:138
void setCollisionObjectsTransform(const Eigen::Isometry3d &pose)
Definition: fcl_utils.h:114
double contact_distance_
The contact distance threshold.
Definition: fcl_utils.h:188
void setContactDistanceThreshold(double contact_distance)
Definition: fcl_utils.h:125
std::vector< CollisionObjectPtr > & getCollisionObjects()
Definition: fcl_utils.h:135
bool sameObject(const CollisionObjectWrapper &other) const
Check if two objects point to the same source object.
Definition: fcl_utils.h:99
const CollisionShapesConst & getCollisionGeometries() const
Definition: fcl_utils.h:110
std::vector< CollisionObjectPtr > collision_objects_
Definition: fcl_utils.h:181
bool m_enabled
Definition: fcl_utils.h:94
int getShapeIndex(const fcl::CollisionObjectd *co) const
Given fcl collision shape get the index to the links collision shape.
Definition: fcl_utils.cpp:368
std::vector< CollisionObjectRawPtr > & getCollisionObjectsRaw()
Definition: fcl_utils.h:137
std::string name_
Definition: fcl_utils.h:175
const tesseract_common::VectorIsometry3d & getCollisionGeometriesTransforms() const
Definition: fcl_utils.h:112
const std::string & getName() const
Definition: fcl_utils.h:96
int type_id_
Definition: fcl_utils.h:176
std::vector< CollisionObjectRawPtr > collision_objects_raw_
The raw pointer is also stored because FCL accepts vectors for batch process. Note: They are updating...
Definition: fcl_utils.h:186
std::shared_ptr< CollisionObjectWrapper > Ptr
Definition: fcl_utils.h:83
short int m_collisionFilterMask
Definition: fcl_utils.h:93
const std::vector< CollisionObjectPtr > & getCollisionObjects() const
Definition: fcl_utils.h:134
const int & getTypeID() const
Definition: fcl_utils.h:97
double getContactDistanceThreshold() const
Definition: fcl_utils.h:132
std::vector< CollisionGeometryPtr > collision_geometries_
Definition: fcl_utils.h:180
Eigen::Isometry3d world_pose_
Collision Object World Transformation.
Definition: fcl_utils.h:177
tesseract_common::VectorIsometry3d shape_poses_
Definition: fcl_utils.h:179
const std::vector< CollisionObjectRawPtr > & getCollisionObjectsRaw() const
Definition: fcl_utils.h:136
const Eigen::Isometry3d & getCollisionObjectsTransform() const
Definition: fcl_utils.h:133
results type_id[0]
Definition: collision_core_unit.cpp:152
CollisionMarginData data(default_margin)
Definition: collision_margin_data_unit.cpp:34
This is a collection of common methods.
Collision Object Wrapper to modify AABB with contact distance threshold.
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
Definition: create_convex_hull.cpp:36
Definition: fcl_collision_object_wrapper.h:36
std::shared_ptr< FCLCollisionObjectWrapper > CollisionObjectPtr
Definition: fcl_utils.h:62
void updateCollisionObjectFilters(const std::vector< std::string > &active, const COW::Ptr &cow, const std::unique_ptr< fcl::BroadPhaseCollisionManagerd > &static_manager, const std::unique_ptr< fcl::BroadPhaseCollisionManagerd > &dynamic_manager)
Update collision objects filters.
Definition: fcl_utils.h:224
std::map< std::string, COW::Ptr > Link2COW
Definition: fcl_utils.h:194
fcl::CollisionObjectd * CollisionObjectRawPtr
Definition: fcl_utils.h:63
std::map< std::string, COW::ConstPtr > Link2ConstCOW
Definition: fcl_utils.h:195
CollisionGeometryPtr createShapePrimitive(const CollisionShapeConstPtr &geom)
Definition: fcl_utils.cpp:153
std::shared_ptr< const fcl::CollisionObjectd > CollisionObjectConstPtr
Definition: fcl_utils.h:64
COW::Ptr createFCLCollisionObject(const std::string &name, const int &type_id, const CollisionShapesConst &shapes, const tesseract_common::VectorIsometry3d &shape_poses, bool enabled)
Definition: fcl_utils.h:197
bool collisionCallback(fcl::CollisionObjectd *o1, fcl::CollisionObjectd *o2, void *data)
Definition: fcl_utils.cpp:202
std::shared_ptr< fcl::CollisionGeometryd > CollisionGeometryPtr
Definition: fcl_utils.h:61
bool distanceCallback(fcl::CollisionObjectd *o1, fcl::CollisionObjectd *o2, void *data)
Definition: fcl_utils.cpp:271
CollisionFilterGroups
Definition: fcl_utils.h:67
@ KinematicFilter
Definition: fcl_utils.h:70
@ StaticFilter
Definition: fcl_utils.h:69
@ DefaultFilter
Definition: fcl_utils.h:68
@ AllFilter
Definition: fcl_utils.h:71
tesseract_geometry::Geometry::ConstPtr CollisionShapeConstPtr
Definition: types.h:48
std::vector< tesseract_geometry::Geometry::ConstPtr > CollisionShapesConst
Definition: types.h:47
bool isLinkActive(const std::vector< std::string > &active, const std::string &name)
This will check if a link is active provided a list. If the list is empty the link is considered acti...
Definition: common.cpp:79
AlignedVector< Eigen::Isometry3d > VectorIsometry3d
Definition: types.h:62
Tesseracts Collision Common Types.
auto pose
Definition: tesseract_environment_collision.cpp:118
auto geom
Definition: tesseract_geometry_unit.cpp:51
m name
Definition: tesseract_scene_graph_link_unit.cpp:77