55 CSphere::Ptr sph = mrpt::make_aligned_shared<CSphere>(0.5);
56 sph->setLocation(0, 0, 0);
57 sph->setColor(1, 0, 0);
60 CDisk::Ptr pln = mrpt::make_aligned_shared<opengl::CDisk>();
61 pln->setDiskRadius(2);
63 pln->setColor(0.8, 0, 0);
67 CDisk::Ptr pln = mrpt::make_aligned_shared<opengl::CDisk>();
68 pln->setDiskRadius(2);
70 pln->setColor(0.9, 0, 0);
83 mrpt::make_aligned_shared<CGridPlaneXY>(-20, 20, -20, 20, 0, 1);
84 plane1->setColor(0.3, 0.3, 0.3);
85 scene1->insert(plane1);
86 scene2->insert(plane1);
87 scene3->insert(plane1);
91 scene1->insert(world);
95 mrpt::make_aligned_shared<CAngularObservationMesh>();
97 mrpt::make_aligned_shared<CAngularObservationMesh>();
99 cout <<
"Performing ray-tracing..." << endl;
100 CAngularObservationMesh::trace2DSetOfRays(
102 CAngularObservationMesh::TDoubleRange::CreateFromAperture(
104 CAngularObservationMesh::TDoubleRange::CreateFromAperture(
106 CAngularObservationMesh::trace2DSetOfRays(
108 CAngularObservationMesh::TDoubleRange::CreateFromAperture(
110 CAngularObservationMesh::TDoubleRange::CreateFromAperture(
112 cout <<
"Ray-tracing done" << endl;
118 origin1->setScale(0.6);
119 scene1->insert(origin1);
120 scene2->insert(origin1);
125 origin2->setScale(0.6);
126 scene1->insert(origin2);
127 scene2->insert(origin2);
133 aom1->generatePointCloud(&M1);
134 aom2->generatePointCloud(&M2);
150 scene2->insert(PTNS1);
151 scene2->insert(PTNS2);
163 std::vector<double> xs, ys, zs;
165 cout <<
"Size of xs in M1: " << xs.size() << endl;
167 cout <<
"Size of xs in M2: " << xs.size() << endl;
173 &run_time, &icp_info);
177 cout <<
"ICP run took " << run_time <<
" secs." << endl;
178 cout <<
"Goodness: " << 100 * icp_info.
goodness 180 <<
" Quality: " << icp_info.
quality << endl;
181 cout <<
"ICP output: mean= " <<
mean << endl;
190 scene3->insert(PTNS1);
191 scene3->insert(PTNS2_ALIGN);
198 window.setPos(10, 10);
199 window2.setPos(530, 10);
200 window3.setPos(10, 520);
202 window.get3DSceneAndLock() = scene1;
203 window.unlockAccess3DScene();
205 window2.get3DSceneAndLock() = scene2;
206 window2.unlockAccess3DScene();
208 window3.get3DSceneAndLock() = scene3;
209 window3.unlockAccess3DScene();
211 std::this_thread::sleep_for(20ms);
212 window.forceRepaint();
213 window2.forceRepaint();
215 window.setCameraElevationDeg(15);
216 window.setCameraAzimuthDeg(90);
217 window.setCameraZoom(15);
219 window2.setCameraElevationDeg(15);
220 window2.setCameraAzimuthDeg(90);
221 window2.setCameraZoom(15);
223 window3.setCameraElevationDeg(15);
224 window3.setCameraAzimuthDeg(90);
225 window3.setCameraZoom(15);
227 cout <<
"Press any key to exit..." << endl;
240 cout <<
"Error: " << e.what() <<
'.' << endl;
245 cout <<
"Unknown Error.\n";
float quality
A measure of the 'quality' of the local minimum of the sqr.
void changeCoordinatesReference(const mrpt::poses::CPose2D &b)
Replace each point by (pose compounding operator).
mrpt::img::TColorf color
Color of points.
mrpt::poses::CPose3DPDF::Ptr Align3D(const mrpt::maps::CMetricMap *m1, const mrpt::maps::CMetricMap *m2, const mrpt::poses::CPose3D &grossEst, float *runningTime=nullptr, void *info=nullptr)
The method for aligning a pair of metric maps, aligning the full 6D pose.
Several implementations of ICP (Iterative closest point) algorithms for aligning two point maps or a ...
virtual void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Returns a 3D object representing the map.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
void generateObjects(CSetOfObjects::Ptr &world)
TConfigParams options
The options employed by the ICP align.
float goodness
A goodness measure for the alignment, it is a [0,1] range indicator of percentage of correspondences...
CPose3D viewpoint2(0.5, -0.2, 2.6, DEG2RAD(-5), DEG2RAD(100), DEG2RAD(-7))
void getAllPoints(VECTOR &xs, VECTOR &ys, VECTOR &zs, size_t decimation=1) const
Returns a copy of the 2D/3D points as a std::vector of float coordinates.
This namespace contains representation of robot actions and observations.
unsigned short nIterations
The number of executed iterations until convergence.
vector< CObservation2DRangeScan > sequence_scans2
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
const size_t HOW_MANY_YAWS
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TRenderOptions renderOptions
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
CSetOfObjects::Ptr CornerXYZ(float scale=1.0)
Returns three arrows representing a X,Y,Z 3D corner.
CPose3D SCAN2_POSE_ERROR(0.15, -0.07, 0.10, -0.03, 0.1, 0.1)
A RGB color - floats in the range [0,1].
The ICP algorithm return information.
The namespace for 3D scene representation and rendering.
Classes for creating GUI windows for 2D and 3D visualization.
double thresholdDist
Initial threshold distance for two points to become a correspondence.
const size_t HOW_MANY_PITCHS
EIGEN_STRONG_INLINE double mean() const
Computes the mean of the entire matrix.
A graphical user interface (GUI) for efficiently rendering 3D scenes in real-time.
vector< CObservation2DRangeScan > sequence_scans1
CPose3D viewpoint1(-0.3, 0.7, 3, DEG2RAD(5), DEG2RAD(80), DEG2RAD(3))