40 #ifndef VOLUME_GRID_H_ 41 #define VOLUME_GRID_H_ 45 #include <pcl/PCLPointCloud2.h> 50 #include <unordered_map> 55 #include <sensor_msgs/PointCloud2.h> 56 #include <visualization_msgs/Marker.h> 58 #include <tbb/parallel_do.h> 60 #include <openvdb/openvdb.h> 61 #include <openvdb/tools/GridTransformer.h> 62 #include <openvdb/tools/RayIntersector.h> 68 #include <boost/thread.hpp> 69 #include <boost/thread/recursive_mutex.hpp> 91 return x==other.
x &&
y==other.
y;
101 frustum(_frustum), accel_factor(_factor)
120 typedef openvdb::math::Ray<openvdb::Real>
GridRay;
121 typedef openvdb::math::Ray<openvdb::Real>::Vec3T
Vec3Type;
125 const bool& pub_voxels);
129 void Mark(
const std::vector<observation::MeasurementReading>& marking_observations);
131 void ClearFrustums(
const std::vector<observation::MeasurementReading>& clearing_observations);
134 void GetOccupancyPointCloud(pcl::PointCloud<pcl::PointXYZ>::Ptr& pc);
135 std::unordered_map<occupany_cell, uint>* GetFlattenedCostmap();
138 bool ResetGrid(
void);
141 bool SaveGrid(
const std::string& file_name,
double& map_size_bytes);
145 void InitializeGrid(
void);
148 bool MarkGridPoint(
const openvdb::Coord& pt,
const double& value)
const;
149 bool ClearGridPoint(
const openvdb::Coord& pt)
const;
152 bool IsGridEmpty(
void)
const;
155 double GetTemporalClearingDuration(
const double& time_delta);
156 double GetFrustumAcceleration(
const double& time_delta, \
157 const double& acceleration_factor);
158 void TemporalClearAndGenerateCostmap(std::vector<frustum_model>& frustums);
161 void PopulateCostmapAndPointcloud(
const openvdb::Coord& pt);
164 openvdb::Vec3d WorldToIndex(
const openvdb::Vec3d& coord)
const;
165 openvdb::Vec3d IndexToWorld(
const openvdb::Coord& coord)
const;
167 mutable openvdb::DoubleGrid::Ptr
_grid;
171 pcl::PointCloud<pcl::PointXYZ>::Ptr
_pc;
185 return ((std::hash<double>()(k.
x) ^ (std::hash<double>()(k.
y) << 1)) >> 1);
const double accel_factor
std::size_t operator()(const volume_grid::occupany_cell &k) const
pcl::PointCloud< pcl::PointXYZ >::Ptr _pc
bool operator==(const occupany_cell &other) const
GlobalDecayModel _decay_model
std::unordered_map< occupany_cell, uint > * _cost_map
openvdb::DoubleGrid::Ptr _grid
openvdb::math::Ray< openvdb::Real >::Vec3T Vec3Type
frustum_model(geometry::Frustum *_frustum, const double &_factor)
occupany_cell(const double &_x, const double &_y)
geometry::Frustum * frustum
openvdb::math::Ray< openvdb::Real > GridRay