ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Collision detection using fcl and ros wiki for octree and regular object

asked 2015-02-12 02:20:30 -0500

RSA_kustar gravatar image

updated 2015-02-15 00:19:31 -0500

I have two objects. The first object is my robot which I want to represent it as a shpare and the second object is the obstacle that has unkonwn shape. I want to represent the shape of the obstacle with octree.

how can i use the api of the fcl to check collision between these two objects ( true or false) usinf fcl libraries using the api form ROS wiki? giving that the robot is moving.

Also, the obstacle is detected using laser scan data?? how to fill it in octree object ??


I wrote the following code but I dont know how to fill the octree

boost::shared_ptr<Sphere> Shpere0(new Sphere(1));
OcTree* tree = new OcTree(boost::shared_ptr<const octomap::OcTree>(generateOcTree()));
// GJKSolver_indep solver;
GJKSolver_libccd solver;
Vec3f contact_points;
FCL_REAL penetration_depth;
Vec3f normal;
Transform3f tf0, tf1;
tf0.setQuatRotation(Quaternion3f(0, 0, 0, 0));

 // HOW TO FILL the OCTREE HERE with point cloud data ???  
 bool res = solver.shapeIntersect(*Shpere0, tf0, *box1, tf1, &contact_points, &penetration_depth, &normal);
 cout << "contact points: " << contact_points << endl;
 cout << "pen depth: " << penetration_depth << endl;
 cout << "normal: " << normal << endl;
 cout << "result: " << res << endl;
 static const int num_max_contacts = std::numeric_limits<int>::max();
 static const bool enable_contact = true;
 fcl::CollisionResult result;
 fcl::CollisionRequest request(num_max_contacts, enable_contact);
 CollisionObject co0(Shpere0, tf0);
 CollisionObject co1(tree, tf1);
bool res_1 =   fcl::collide(&co0, &co1, request, result);


How can I fill the octree or octmap to be presented as an object and I can use the function collied to check if the shapre ( which represent my robot) is going to collied with the octree or octmap that I should construct from a point cloud data ?

edit retag flag offensive close merge delete


No that one is general for FCL and and BVH and this one more specified for collision detection and octree.. I thought your comment was an answer !!!

RSA_kustar gravatar image RSA_kustar  ( 2015-02-12 06:03:12 -0500 )edit

@RSA_kustar Hi, were you able to check for collisions with the octree as a CollisionObject? Or did you have to convert the tree to boxes like in your other question? Thank you

ap gravatar image ap  ( 2019-03-27 08:51:35 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-05-09 15:49:49 -0500

cyberguy42 gravatar image

I would recommend looking at the source code for the Octomap Server. Its purpose is to take in a pointcloud and update an octree (this happens in function void OctomapServer::insertCloudCallback).

edit flag offensive delete link more

Question Tools



Asked: 2015-02-12 02:20:30 -0500

Seen: 1,520 times

Last updated: May 09 '17