test_scans.cpp
Go to the documentation of this file.
1 
2 #include <stdio.h>
3 #include <octomap/octomap.h>
4 #include <octomap/math/Utils.h>
5 
6 using namespace std;
7 using namespace octomap;
8 
9 
10 
11 int main(int argc, char** argv) {
12 
13 
14  //##############################################################
15 
16  OcTree tree (0.05);
17 
18  point3d origin (0.01f, 0.01f, 0.02f);
19  point3d point_on_surface (4.01f, 0.01f, 0.01f);
20 
21  cout << "generating spherical scan at " << origin << " ..." << endl;
22 
23  Pointcloud cloud;
24 
25  for (int i=-100; i<101; i++) {
26  for (int j=-100; j<101; j++) {
27  point3d rotated = point_on_surface;
28  rotated.rotate_IP(0, DEG2RAD(i*0.5), DEG2RAD(j*0.5));
29  cloud.push_back(rotated);
30  }
31  }
32 
33  // insert in global coordinates:
34  tree.insertPointCloud(cloud, origin);
35 
36  cout << "done." << endl;
37  cout << "writing to spherical_scan.bt..." << endl;
38  tree.writeBinary("spherical_scan.bt");
39 
40 
41 
42 }
void push_back(float x, float y, float z)
Definition: Pointcloud.h:61
virtual void insertPointCloud(const Pointcloud &scan, const octomap::point3d &sensor_origin, double maxrange=-1., bool lazy_eval=false, bool discretize=false)
Vector3 & rotate_IP(double roll, double pitch, double yaw)
Definition: Vector3.cpp:41
bool writeBinary(const std::string &filename)
int main(int argc, char **argv)
Definition: test_scans.cpp:11
This class represents a three-dimensional vector.
Definition: Vector3.h:50
#define DEG2RAD(x)
Definition: Utils.h:47


octomap
Author(s): Kai M. Wurm , Armin Hornung
autogenerated on Wed Jun 5 2019 19:26:27