flexible-collision-library / fcl

Flexible Collision Library
https://flexible-collision-library.github.io/
Other
1.35k stars 414 forks source link

[question]Is it possible to perform collision detection based on a distance threshold? #552

Closed WangZP10969 closed 2 years ago

WangZP10969 commented 2 years ago

I am using fcl for collision detection, using the direct return bool type as the result of the collision But the default collision method requires object contact to return true. I need to return true when the distance is less than a certain threshold.

I have considered two methods,

  1. Expand the collision model, similar to modifying the parameters of the geometric shape, offset and superimpose the surface and point cloud
  2. Directly use the closest distance calculation, and then judge whether the distance meets the threshold. In this case, a complete distance calculation may be required, and the calculation speed is slower than directly returning the collision result

Would you like to give me some suggestions for completing this function based on fcl?

Looking forward to your help

florent-lamiraux commented 2 years ago

This is possible in another version of fcl located here: https://github.com/humanoid-path-planner/hpp-fcl. You simply need to set the distance threshold in the collision request here: https://github.com/humanoid-path-planner/hpp-fcl/blob/ea9afdc2ee5771826a12a769a108368cd0c57212/include/hpp/fcl/collision_data.h#L221. This does not imply extra computation cost compared to collision checking.