common.cpp
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002          |                     Mobile Robot Programming Toolkit (MRPT)               |
00003          |                          http://www.mrpt.org/                             |
00004          |                                                                           |
00005          | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file        |
00006          | See: http://www.mrpt.org/Authors - All rights reserved.                   |
00007          | Released under BSD License. See details in http://www.mrpt.org/License    |
00008          +---------------------------------------------------------------------------+ */
00009 
00010 #include <mrpt/math/utils.h>
00011 #include "mrpt_graphslam_2d/misc/common.h"
00012 
00013 using namespace mrpt::poses;
00014 using namespace mrpt::math;
00015 using namespace std;
00016 using namespace mrpt::math;
00017 using namespace mrpt::utils;
00018 
00019 std::string mrpt::graphslam::detail::getGridMapAlignmentResultsAsString(
00020                         const mrpt::poses::CPosePDF& pdf,
00021                         const mrpt::slam::CGridMapAligner::TReturnInfo& ret_info) {
00022 
00023                         CPosePDFSOGPtr pdf_out = CPosePDFSOG::Create();
00024                         pdf_out->copyFrom(pdf);
00025                         CPose2D pose_out; CMatrixDouble33 cov_out;
00026                         pdf_out->getMostLikelyCovarianceAndMean(cov_out, pose_out);
00027 
00028                         stringstream ss;
00029                         ss << "--------------------" << endl;
00030                         ss << "Results: " << endl
00031                                 << "\tPDFPtr pose: " << pdf.getMeanVal() << endl
00032                                 << "\t# Correspondences: " << ret_info.correspondences.size() << endl
00033                                 << "\tAlignment goodness: " << ret_info.goodness << endl
00034                                 << "\tModes size: " << pdf_out->size() << endl
00035                                 << "\tModes: " << endl << getSTLContainerAsString(pdf_out->getSOGModes())
00036                                 << "\tMost likely pose: " << pose_out << endl
00037                                 << "\tCorresponding covariance matrix: " << endl
00038                                 << cov_out << endl;
00039                         ss << "--------------------" << endl;
00040                         return ss.str();
00041 }
00042 
00043 bool mrpt::graphslam::detail::isEssentiallyZero(
00044                 const mrpt::poses::CPose2D& p) {
00045         double epsilon = 0.001;
00046         return (
00047                         approximatelyEqual(p.x(), 0.0, epsilon) && // all 0s
00048                         approximatelyEqual(p.y(), 0.0, epsilon) &&
00049                         approximatelyEqual(p.phi(), 0.0, epsilon));
00050 }


mrpt_graphslam_2d
Author(s): Nikos Koukis
autogenerated on Sun Sep 17 2017 03:02:04