Can't convert OcTree to Fcl
Hello everyone,
I'm trying to create a code for 2D collision checking using fcl and octomap.
Here i'm trying to convert the octomap::octree to fcl::octree so that i can use the function: "generateBoxesFromOctomap".
I am following this program as a guide: link
I'm using ROS kinetic on Ubuntu 16.04, fcl is version 0.6.
This is my code:
OcTree* octTree = new OcTree(0.1);
Pointcloud octPointCloud;
for (int x=-20; x<20; x++) {
for (int y=-20; y<20; y++) {
point3d endpoint ((float) x*0.05f, (float) y*0.05f, (float) 0.0);
if (endpoint.x() < 0.7 && endpoint.x() > 0.3 && endpoint.y()< 0.6 && endpoint.y() > 0.8) //size of the obstacle
octPointCloud.push_back(endpoint);
}
}
point3d origin(0.0,0.0,0.0);
octTree->insertPointCloud(octPointCloud,origin);
octTree->updateInnerOccupancy();
//convert the octomap
fcl::OcTree<double>* tree2 = new fcl::OcTree(boost::shared_ptr<const octomap::OcTree>(octTree));
std::vector<fcl::CollisionObject<double>*> boxes;
generateBoxesFromOctomap(boxes, *tree2);
but i get this error:
error: expected type-specifier
fcl::OcTree<double>* tree2 = new fcl::OcTree(boost::shared_ptr<const octomap::OcTree>(octTree))
What can i do?
In a similar working example I have, I am using :
fcl::OcTree* tree2
, try without using the <double> maybeNow it gives me two more error:
don't know what to do
My fault, my previous comment is for
CollisionGeometry
type and notColiisionObject
. But, according to this test file, you should havefcl::OcTree<double>* tree2 = new fcl::OcTree<double>(std::shared_ptr<const octomap::OcTree>(octTree));
Yes, now it works Thanks for your help!
Added the answer below, you may mark it as correct :)