22 const std::string& layer,
28 std::cerr <<
"Octomap conversion only implemented for standard OcTree type." << std::endl;
39 std::vector<octomap::OcTreeNode*> collapsed_occ_nodes;
41 collapsed_occ_nodes.clear();
43 if (octomapCopy.
isNodeOccupied(*it) && it.getDepth() < max_depth) {
44 collapsed_occ_nodes.push_back(&(*it));
47 for (std::vector<octomap::OcTreeNode*>::iterator it = collapsed_occ_nodes.begin();
48 it != collapsed_occ_nodes.end(); ++it) {
49 #if OCTOMAP_VERSION_BEFORE_ROS_KINETIC 52 octomapCopy.expandNode(*it);
56 }
while (collapsed_occ_nodes.size() > 0);
63 octomapCopy.
getMetricMin(minBound(0), minBound(1), minBound(2));
64 octomapCopy.
getMetricMax(maxBound(0), maxBound(1), maxBound(2));
80 (maxBound(1) + minBound(1)) / 2.0);
95 for(octomap::OcTree::leaf_bbx_iterator it = octomapCopy.
begin_leafs_bbx(minBbx, maxBbx),
104 gridMapData(index(0), index(1)) = octoPos.
z();
108 if (gridMapData(index(0), index(1)) < octoPos.
z()) {
109 gridMapData(index(0), index(1)) = octoPos.
z();
void setGeometry(const Length &length, const double resolution, const Position &position=Position::Zero())
iterator begin(unsigned char maxDepth=0) const
void setBasicLayers(const std::vector< std::string > &basicLayers)
std::string getTreeType() const
const iterator end() const
static bool fromOctomap(const octomap::OcTree &octomap, const std::string &layer, grid_map::GridMap &gridMap, const grid_map::Position3 *minPoint=nullptr, const grid_map::Position3 *maxPoint=nullptr)
leaf_bbx_iterator begin_leafs_bbx(const OcTreeKey &min, const OcTreeKey &max, unsigned char maxDepth=0) const
unsigned int getTreeDepth() const
bool isValid(const Index &index) const
Eigen::Vector3d Position3
virtual void getMetricMin(double &x, double &y, double &z)
virtual ~GridMapOctomapConverter()
virtual void getMetricMax(double &x, double &y, double &z)
void add(const std::string &layer, const double value=NAN)
GridMapOctomapConverter()
double getResolution() const
octomath::Vector3 point3d
const leaf_bbx_iterator end_leafs_bbx() const
bool getIndex(const Position &position, Index &index) const
bool isNodeOccupied(const OcTreeNode *occupancyNode) const