Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <mrpt/math/utils.h>
00011 #include "mrpt_graphslam_2d/misc/common.h"
00012
00013 #include <mrpt/version.h>
00014 #if MRPT_VERSION>=0x199
00015 #include <mrpt/containers/stl_containers_utils.h>
00016 using namespace mrpt::containers;
00017 #else
00018 using namespace mrpt::utils;
00019 #endif
00020
00021 using namespace mrpt::poses;
00022 using namespace mrpt::math;
00023 using namespace std;
00024 using namespace mrpt::math;
00025
00026 std::string mrpt::graphslam::detail::getGridMapAlignmentResultsAsString(
00027 const mrpt::poses::CPosePDF& pdf,
00028 const mrpt::slam::CGridMapAligner::TReturnInfo& ret_info) {
00029
00030 CPosePDFSOG::Ptr pdf_out = CPosePDFSOG::Create();
00031 pdf_out->copyFrom(pdf);
00032 CPose2D pose_out; CMatrixDouble33 cov_out;
00033 pdf_out->getMostLikelyCovarianceAndMean(cov_out, pose_out);
00034
00035 stringstream ss;
00036 ss << "--------------------" << endl;
00037 ss << "Results: " << endl
00038 << "\tPDFPtr pose: " << pdf.getMeanVal() << endl
00039 << "\t# Correspondences: " << ret_info.correspondences.size() << endl
00040 << "\tAlignment goodness: " << ret_info.goodness << endl
00041 << "\tModes size: " << pdf_out->size() << endl
00042 << "\tModes: " << endl << getSTLContainerAsString(pdf_out->getSOGModes())
00043 << "\tMost likely pose: " << pose_out << endl
00044 << "\tCorresponding covariance matrix: " << endl
00045 << cov_out << endl;
00046 ss << "--------------------" << endl;
00047 return ss.str();
00048 }
00049
00050 bool mrpt::graphslam::detail::isEssentiallyZero(
00051 const mrpt::poses::CPose2D& p) {
00052 double epsilon = 0.001;
00053 return (
00054 approximatelyEqual(p.x(), 0.0, epsilon) &&
00055 approximatelyEqual(p.y(), 0.0, epsilon) &&
00056 approximatelyEqual(p.phi(), 0.0, epsilon));
00057 }