laserIMUCalibration
main.cpp
Go to the documentation of this file.
1 
8 #include <dirent.h>
9 #include <vector>
10 #include <string>
11 #include <iostream>
12 
13 #include <pcl/common/io.h>
14 #include <pcl/io/pcd_io.h>
15 #include "laserNAVCalib.h"
16 
17 //convenient typedefs
18 typedef pcl::PointNormal PointT;
19 typedef pcl::PointCloud<PointT> pointCloud;
20 
21 std::vector<std::string> open(std::string path = ".") {
22  DIR* dir;
23  dirent* pdir;
24  std::vector<std::string> scans;
25 
26  dir = opendir(path.c_str());
27 
28  while ((pdir = readdir(dir))) {
29  scans.push_back(path + pdir->d_name);
30  }
31 
32  scans.erase(std::find(scans.begin(), scans.end(), path + "."));
33  scans.erase(std::find(scans.begin(), scans.end(), path + ".."));
34 
35  return scans;
36 }
37 
38 int main(int argc, char* argv[]) {
39  if (argc < 2) {
40  return EXIT_FAILURE;
41  }
42 
43  std::vector<std::string> scans = open(argv[1]);
44  filter::LaserNAVCalibration calibrator(0.43, 0, -0.15, 90, 0, 90);
45 
46  for (auto scan : scans) {
47  switch (argc) {
48  case 2:
49  calibrator.setScansBetweenLastAndLatest(atoi(argv[2]));
50  }
51  pointCloud::Ptr new_cloud_data (new pointCloud);
52  pcl::io::loadPCDFile(scan, *new_cloud_data);
53  calibrator.update(new_cloud_data);
54  }
55  return 1;
56 }
std::vector< std::string > open(std::string path=".")
Definition: main.cpp:21
pcl::PointNormal PointT
Definition: main.cpp:18
Filter to calibrate the Laser mounting Pose according to NAV-data.
Definition: laserNAVCalib.h:41
This file introduces the class LaserNAVCalibration which is used to calibrate the laser-pose with nav...
pcl::PointCloud< pcl::PointNormal > pointCloud
Typedef for shorter call of point-cloud-pointer-type.
Definition: laserNAVCalib.h:25
virtual void update(pointCloud::Ptr cloud_to_draw)
Updates the mounting-pose using Levenberg-Marquardt non-linear optimization.
pcl::PointCloud< PointT > pointCloud
Definition: main.cpp:19
int main(int argc, char *argv[])
Definition: main.cpp:38
void setScansBetweenLastAndLatest(unsigned int scans_between_last_and_latest)
Sets the number of scans to skip between one registration.