How to convert a certain voxel to be occupied?
HangX-Ma opened this issue · 0 comments
HangX-Ma commented
Hello sir, when using your OctoMap
package, I met some problem about updating a certain voxel
property.
I converted a certain voxel
to be occupied with the code below, but my path planner reflected that this voxel
changed nothing.
I have read your manual online. If I understand your annotation correctly, this code should have worked well.
I hope you can get me out of the 'code trap'. Thanks a lot !
setCurrNodeObs(octomap::OcTreeKey &key, std::shared_ptr<octomap::OcTree> &tree) {
tree->updateNode(key, true); // 'true' if the node is occupied
tree->updateInnerOccupancy();
}
[UPDATE 2022.03.14]
I need to add some info about how I recognize a node as an obstacle.
I have checked some nodes' occupancy value, and the result seems not like I thought previously.
bool isOccupied(octomap::OcTreeNode* currNode) {
return currNode!=NULL && currNode->getOccupancy() >= 0.5;
}
@ahornung [question]