scan_io_oct.cc
Go to the documentation of this file.
1 
6 #include "slam6d/Boctree.h"
7 #include "slam6d/scan_io_oct.h"
8 #include "slam6d/globals.icc"
9 #include <fstream>
10 using std::ifstream;
11 #include <iostream>
12 using std::cout;
13 using std::cerr;
14 using std::endl;
15 
16 
34 int ScanIO_oct::readScans(int start, int end, string &dir, int maxDist, int mindist,
35  double *euler, vector<Point> &ptss)
36 {
37  static int fileCounter = start;
38  string scanFileName;
39  string poseFileName;
40 
41  ifstream pose_in;
42 
43  //double maxDist2 = sqr(maxDist);
44 
45  int my_fileNr = fileCounter;
46 
47  if (end > -1 && fileCounter > end) return -1; // 'nuf read
48  scanFileName = dir + "scan" + to_string(fileCounter,3) + ".oct";
49  poseFileName = dir + "scan" + to_string(fileCounter,3) + ".pose";
50 
51 // scan_in.open(scanFileName.c_str());
52  pose_in.open(poseFileName.c_str());
53 
54  // read 3D scan
55  if (!pose_in.good() ) return -1; // no more files in the directory
56  if (!pose_in.good()) { cerr << "ERROR: Missing file " << poseFileName << endl; exit(1); }
57  cout << "Processing Scan " << scanFileName;
58 
59  for (unsigned int i = 0; i < 6; pose_in >> euler[i++]);
60 
61  cout << " @ pose (" << euler[0] << "," << euler[1] << "," << euler[2]
62  << "," << euler[3] << "," << euler[4] << "," << euler[5] << ")" << endl;
63 
64  // convert angles from deg to rad
65  for (unsigned int i = 3; i <= 5; i++) euler[i] = rad(euler[i]);
66 
67  BOctTree<float>::deserialize(scanFileName, ptss);
68 
69  pose_in.close();
70  pose_in.clear();
71  fileCounter++;
72 
73  return my_fileNr;
74 }
75 
ScanIO_oct::readScans
virtual int readScans(int start, int end, string &dir, int maxDist, int mindist, double *euler, vector< Point > &ptss)
Definition: scan_io_oct.cc:34
scan_io_oct.h
IO of a 3D scan in oct-file format.
Boctree.h
Efficient representation of an octree.
BOctTree::deserialize
void deserialize(std::string filename)
Definition: Boctree.h:433


lvr2
Author(s): Thomas Wiemann , Sebastian Pütz , Alexander Mock , Lars Kiesow , Lukas Kalbertodt , Tristan Igelbrink , Johan M. von Behren , Dominik Feldschnieders , Alexander Löhr
autogenerated on Wed Mar 2 2022 00:37:24