51 std::ofstream binary_outfile( filename.c_str(), std::ios_base::binary);
53 if (!binary_outfile.is_open()){
61 std::ofstream binary_outfile( filename.c_str(), std::ios_base::binary);
63 if (!binary_outfile.is_open()){
68 binary_outfile.close();
81 s <<
binaryFileHeader <<
"\n# (feel free to add / change comments, but leave the first line as it is!)\n#\n";
83 s <<
"size "<< this->
size() << std::endl;
85 s <<
"data" << std::endl;
105 s.read((
char*)&tree_type,
sizeof(tree_type));
110 s.read((
char*)&res,
sizeof(res));
116 s.read((
char*)&size,
sizeof(size));
127 std::ifstream binary_infile( filename.c_str(), std::ios_base::binary);
128 if (!binary_infile.is_open()){
143 std::istream::pos_type streampos = s.tellg();
144 std::getline(s, line);
172 if (size != this->
size()){
173 OCTOMAP_ERROR(
"Tree size mismatch: # read nodes (%zu) != # expected nodes (%d)\n",this->
size(), size);
virtual std::string getTreeType() const =0
returns actual class name as string for identification
void setClampingThresMax(double thresProb)
sets the maximum threshold for occupancy clamping (sensor model)
#define OCTOMAP_DEBUG(...)
void setProbHit(double prob)
sets the probability for a "hit" (will be converted to logodds) - sensor model
static bool readHeader(std::istream &s, std::string &id, unsigned &size, double &res)
virtual size_t size() const =0
void setProbMiss(double prob)
sets the probability for a "miss" (will be converted to logodds) - sensor model
virtual double getResolution() const =0
virtual void toMaxLikelihood()=0
virtual std::ostream & writeBinaryData(std::ostream &s) const =0
Writes the actual data, implemented in OccupancyOcTreeBase::writeBinaryData()
bool writeBinary(const std::string &filename)
bool writeBinaryConst(const std::string &filename) const
#define OCTOMAP_WARNING_STR(args)
static const std::string binaryFileHeader
void setOccupancyThres(double prob)
sets the threshold for occupancy (sensor model)
AbstractOccupancyOcTree()
#define OCTOMAP_ERROR_STR(args)
#define OCTOMAP_DEBUG_STR(args)
virtual void setResolution(double res)=0
bool readBinary(std::istream &s)
bool readBinaryLegacyHeader(std::istream &s, unsigned int &size, double &res)
Try to read the old binary format for conversion, will be removed in the future.
#define OCTOMAP_ERROR(...)
virtual std::istream & readBinaryData(std::istream &s)=0
Reads the actual data, implemented in OccupancyOcTreeBase::readBinaryData()
void setClampingThresMin(double thresProb)
sets the minimum threshold for occupancy clamping (sensor model)