Hi again,
For everyone wondering in the future: I solved it by using a leaf_iterator to iterate over the leaves. Still takes more time than I wanted, though. I still have to check if this is good(=fast) enough for what I'm trying to do, but I'm happy to have found a way to get the coordinates of the node at last, even if it's probably to slow.
The whole thing looks like this:
double d = fcl::distance(o1,o2,dist_req,dist_result); //o1 and o2 are fcl::CollisionObjects, o2 belongs to the robot. See
https://github.com/ros-planning/moveit_core/blob/hydro-devel/collision_detection_fcl/src/collision_common.cpp#L440//The following goes right under line 449, in the
if(cdata->res_->distance > d) block. cd1 is already computed above in line 364.if (cd1->ptr.obj->shapes_[0]->type == shapes::OCTREE){
shapes::ShapeConstPtr shapeCP = cd1->ptr.obj->shapes_[0];
const shapes::OcTree* ocShape = dynamic_cast<const shapes::OcTree*> (shapeCP.get());
const octomap::OcTree* oct = ocShape->octree.get();
const octomap::OcTreeNode* rootNode = oct->getRoot();
const octomap::OcTreeNode* closestNode = treeRott + dist_result.b1;
octomap::OcTreeBaseImp<octomap::OcTreeNode, octomap::AbstracOccupancyOcTree>::iterator ocTreeIt, end;
ocTreeIt = oct->begin(0);
bool found = false;
for (end = oct->end(); !found && ocTreeIt != end; ++ocTreeIt){
if (closestNode == &(*ocTreeIt)){
found = true;
//get position of node with ocTreeIt.getX() / getY() / getZ()
}
}
}
Best Regards,
Alisa