common.cpp
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) | |
3  http://www.mrpt.org/ | | | | Copyright (c)
4  2005-2016, Individual contributors, see AUTHORS file | | See:
5  http://www.mrpt.org/Authors - All rights reserved. | |
6  Released under BSD License. See details in http://www.mrpt.org/License |
7  +---------------------------------------------------------------------------+
8  */
9 
10 #include <mrpt/math/utils.h>
12 #include <mrpt/containers/stl_containers_utils.h>
13 
14 using namespace mrpt::containers;
15 using namespace mrpt::poses;
16 using namespace mrpt::math;
17 using namespace std;
18 using namespace mrpt::math;
19 
21  const mrpt::poses::CPosePDF& pdf,
22  const mrpt::slam::CGridMapAligner::TReturnInfo& ret_info)
23 {
24  CPosePDFSOG::Ptr pdf_out = CPosePDFSOG::Create();
25  pdf_out->copyFrom(pdf);
26  CPose2D pose_out;
27  CMatrixDouble33 cov_out;
28  pdf_out->getMostLikelyCovarianceAndMean(cov_out, pose_out);
29 
30  stringstream ss;
31  ss << "--------------------" << endl;
32  ss << "Results: " << endl
33  << "\tPDFPtr pose: " << pdf.getMeanVal() << endl
34  << "\t# Correspondences: " << ret_info.correspondences.size() << endl
35  << "\tAlignment goodness: " << ret_info.goodness << endl
36  << "\tModes size: " << pdf_out->size() << endl
37  << "\tModes: " << endl
38  << getSTLContainerAsString(pdf_out->getSOGModes())
39  << "\tMost likely pose: " << pose_out << endl
40  << "\tCorresponding covariance matrix: " << endl
41  << cov_out << endl;
42  ss << "--------------------" << endl;
43  return ss.str();
44 }
45 
46 bool mrpt::graphslam::detail::isEssentiallyZero(const mrpt::poses::CPose2D& p)
47 {
48  double epsilon = 0.001;
49  return (
50  approximatelyEqual(p.x(), 0.0, epsilon) && // all 0s
51  approximatelyEqual(p.y(), 0.0, epsilon) &&
52  approximatelyEqual(p.phi(), 0.0, epsilon));
53 }
std::string getGridMapAlignmentResultsAsString(const mrpt::poses::CPosePDF &pdf, const mrpt::slam::CGridMapAligner::TReturnInfo &ret_info)
Definition: common.cpp:20
bool isEssentiallyZero(const mrpt::poses::CPose2D &p)
Definition: common.cpp:46
double epsilon


mrpt_graphslam_2d
Author(s): Nikos Koukis
autogenerated on Sun Jun 26 2022 02:12:26