string filenamebt = "map1.bt";
AbstractOccupancyOcTree* binaryTree = AbstractOccupancyOcTree::readBinary(filenamebt);
and the error is:
In function ‘int main(int, char**)’:
cannot call member function ‘bool octomap::AbstractOccupancyOcTree::readBinary(const string&)’ without object
AbstractOccupancyOcTree* binaryTree = AbstractOccupancyOcTree::readBinary(filenamebt);
^
make[2]: *** [CMakeFiles/octo_to_pcd.dir/octo_to_pcd.cpp.o] Error 1
make[1]: *** [CMakeFiles/octo_to_pcd.dir/all] Error 2
make: *** [all] Error 2
Another thing is that I want to convert the bt/ot file into pcl, and I followed some code from Internet
std::list<octomap::OcTreeVolume> occupiedCells;
binaryTree.getOccupied(occupiedCells);
//cloud to store the points
pcl::PointCloud<pcl::PointXYZ> cloud;
cloud.points.resize(occupiedCells.size());
std::list<octomap::OcTreeVolume>::iterator it;
int i=0;
for (it = occupiedCells.begin(); it != occupiedCells.end(); ++it, i++)
{
//add point in point cloud
cloud.points[i].x = it->first.x();
cloud.points[i].y = it->first.y();
cloud.points[i].z = it->first.z();
}
//save cloud
pcl::io::savePCDFileASCII ("file.pcd", cloud);
return 0;
But the code doesn't work anymore, because the h file no longer exist.
So, thank you very much for yuor help!