MROB
create_points.hpp
1 /* Copyright (c) 2022, Gonzalo Ferrer
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  *
16  * create_points.hpp
17  *
18  * Created on: Feb 6, 2018
19  * Author: Gonzalo Ferrer
20  * g.ferrer@skoltech.ru
21  * Mobile Robotics Lab, Skoltech
22  */
23 
24 #ifndef CREATE_POINTS_HPP_
25 #define CREATE_POINTS_HPP_
26 
27 #include "mrob/SE3.hpp"
28 #include "mrob/plane.hpp"
29 #include "mrob/plane_registration.hpp"
30 #include <random>
31 #include <memory>
32 #include <utility>
33 #include <Eigen/StdVector> // for fixed size SE3 objects
34 
35 
36 
37 using namespace Eigen;
38 
39 namespace mrob{
40 
47  public:
48  SampleUniformSE3(double R_range, double t_range);
49  SampleUniformSE3(double R_min, double R_max, double t_min, double t_max);
51  SE3 samplePose();
52  Mat31 samplePosition();
53  SO3 sampleOrientation();
54  protected:
55  std::default_random_engine generator_;
56  std::uniform_real_distribution<double> rotationUniform_;
57  std::uniform_real_distribution<double> tUniform_;
58 };
59 
65  public:
66  SamplePlanarSurface(double zStd, double bias = 0.0);
71  Mat31 samplePoint();
72  void sampleBias();
73 
74  protected:
75  std::default_random_engine generator_;
76  std::uniform_real_distribution<double> x_, y_;
77  std::normal_distribution<double> z_, bias_;
78  double xBias_ {}, yBias_ {};
79 };
80 
85 public:
89  CreatePoints(uint_t N = 10, uint_t numberPlanes = 4, uint_t numberPoses = 2,
90  double noisePerPoint = 0.01, double noiseBias = 0.1,
91  const SE3 &initial_pose = SE3());
92  ~CreatePoints();
93 
101  void create_plane_registration(PlaneRegistration& planeReg);
102 
103  std::vector<Mat31>& get_point_cloud(uint_t t);
104  std::vector<uint_t>& get_point_plane_ids(uint_t t);
105 
106  uint_t get_number_planes() const {return numberPlanes_;};
107  uint_t get_number_poses() const {return numberPoses_;};
108 
109  std::vector<SE3>& get_ground_truth_trajectory() {return goundTruthTrajectory_;};
110  SE3 get_ground_truth_last_pose() {return goundTruthTrajectory_.back();};
111  SE3 get_ground_truth_pose(uint_t i);
112 
113  std::vector<SE3>& get_plane_poses() {return planePoses_;};
114  std::vector<std::pair<uint_t, std::shared_ptr<Plane> >>& get_all_planes() {return planes_;}
115 
116  std::vector<Mat41>& get_plane_states() {return plane_states_;};
117 
118  void print() const;
119 
120 
121 protected:
122  // generation parameters
123  uint_t numberPoints_; // Number of points
124  uint_t numberPlanes_; // Number of planes in the virtual environment
125  double noisePerPoint_, noiseBias_;
126  double rotationRange_;
127  double transRange_;
128  double lamdaOutlier_;
129  SampleUniformSE3 samplePoses_,samplePlanes_;
130  SamplePlanarSurface samplePoints_;
131 
132  // Point cloud data generated
133  std::vector< std::vector<Mat31> > X_;
134  // IDs for facilitating the task of DA and normal computation
135  std::vector< std::vector<uint_t>> pointId_;
136 
137  // Trajectory parameters
138  double xRange_, yRange_; // dimension of the workspace
139  SE3 initialPose_;
140  std::vector<SE3> goundTruthTrajectory_;// ground truth trajectory
141  uint_t numberPoses_;
142 
143  // Generation of planes
144  std::vector<SE3> planePoses_;
145  std::vector<Mat41> plane_states_;
146  std::vector<std::pair<uint_t, std::shared_ptr<Plane> >> planes_;//TODO this should be removed...
147 
148 
149 };
150 
151 }
152 #endif /* CREATE_POINTS_HPP_ */
Definition: SE3.hpp:50
Definition: create_points.hpp:64
Definition: create_points.hpp:46
Definition: create_points.hpp:84
Definition: SO3.hpp:49
Definition: plane_registration.hpp:46
Special Euclidean (group) in 3d Is the group representing rotations and translations, that is, rigid body transformations. SE3 = {T = [R t] | R SO3 , t Re^3 } [0 1] Associated to the groups of RBT, there is the Lie algebra se3 representing the same transformation in the tangent space around the identity. Particularly, xi =[w , v] Re^6, where w Re^3 represents the rotation and v the translation. We will preserve this order in this class.
Definition: matrix_base.hpp:36