0

I want to use FCL library for collision detection only.

My first object is the robot where I want to specify it using a sphere shape and second the obstacles in the world using octree.

I tried to follow the instruction in order to create this detection code.

How can I fill the following information from the API in ROS wiki?

// set mesh triangles and vertice indices
std::vector<Vec3f> vertices;  
std::vector<Triangle> triangles;
// code to set the vertices and triangles
 ...
// BVHModel is a template class for mesh geometry, for default OBBRSS     template is used
typedef BVHModel<OBBRSS>* Model;
Model* model = new Model();
// add the mesh data into the BVHModel structure
model->beginModel();
model->addSubModel(vertices, triangles);
model->endModel();

In this API they are using triangle and as far as I know that triangles are only used for 3d meshes. I don't want to use meshes, I want octree and sphere as objects.

  1. So how can I modify that?
  2. After that, which function should I use to return true or false that the collision happened?
  3. what if my data is updated? I mean the robot is moving and I want to keep updating the position of the robot and the octree? how can I perform that?
  4. what is the meaning of the BVH model?

I looked for examples and found the following thing:

Sphere s1(10);
Box s2(5, 5, 5);
Transform3f transform;
Transform3f identity;
CollisionRequest request;
CollisionResult result;
bool res;
res = (collide(&s1, Transform3f(), &s2, Transform3f(), request, result) > 0);
std::cout << "res" << res << std::endl;

The output was "res1"

What does the '1' mean? Does it mean it is a collision? And what is the meaning of collision physically here? Where is the position of the objects and why this is not following the API of the ROS wiki?

Sorry for the long question but I using the FCL for the first time and I don't know anything about it.

luator
  • 4,769
  • 3
  • 30
  • 51
RSA
  • 79
  • 12

1 Answers1

1

First of all: This is only a partially answer. I do not know FCL, but I can generally answer question 4. Maybe someone else answers the other points.

4) What is the meaning of the BVH model?

BVH is short for Bounding Volume Hierarchy. A bounding volume is a geometric shape that encloses the points (or triangles) of some model. A simple example is a bounding box, but there are other, more complex ones.

A BVH is a tree structure of many bounding volumes: The root node is a BV enclosing the whole model. Then the points of the the model are split into two distinct subsets. For each of these subsets a new BV is computed. These new BVs form the child nodes of the root.

The child nodes are again split, continuing this process recursively until some termination criterion is fullfilled (e.g. number of points in a node is less than some predefined limit). The leaf nodes of this structure contain the actual points of the model.

Now, what is this BVH good for?

The purpose of this stucture is to reduce computation time in tasks like collision detection:

Lets assume, I want to know, if the robot collides with some obstacle. If I have a BVH for the robot model, I at first only check if the root bounding volume collides with the obstacle.

If they do not collide, I am immediately finished (If the bounding volume does not collide, the enclosed robot model can not collide either).

If they do collide, I have to go down in the hierarchy, checking if the child BVs collide with the obstacle. If one of them collides, I have to go further down, recursively checking its childs. If, however, one of them does not collide, I can cull away the whole subtree hanging at this node, saving lots of computations. Only if I reach a leaf node, I have to look at the actual points of the robot model.

More information can, for example, be found on Wikipedia.

I think, however, that the BVH is only usefull if your models are complex meshes, so I guess you will need something different here.

luator
  • 4,769
  • 3
  • 30
  • 51