<NME> grid-matching_main.cpp
<BEF> /* +------------------------------------------------------------------------+
   |                     Mobile Robot Programming Toolkit (MRPT)            |
   |                          https://www.mrpt.org/                         |
   |                                                                        |
   | Copyright (c) 2005-2022, Individual contributors, see AUTHORS file     |
   | See: https://www.mrpt.org/Authors - All rights reserved.               |
   | Released under BSD License. See: https://www.mrpt.org/License          |
   +------------------------------------------------------------------------+ */

#include <mrpt/apps/CGridMapAlignerApp.h>

int main(int argc, char** argv)
{
	try
	{
		mrpt::apps::CGridMapAlignerApp app;

		app.initialize(argc, argv);
		app.run();
	}
	catch (const std::exception& e)
	{
		std::cerr << mrpt::exception_to_str(e) << std::endl;
		return 1;
	}
}
bool	IS_VERBOSE;
bool	NOSAVE=false;
bool	SKIP_ICP_STAGE=false;

string 	SAVE_ICP_GOODNESS_FIL;

				CMatrixDouble33	estimateCOV;

				// Get the mean, or the best Gassian mean in the case of a SOG:
				if (IS_CLASS(parts,CPosePDFSOG))
				{
					CPosePDFSOGPtr pdf_SOG= CPosePDFSOGPtr( parts );
					pdf_SOG->getMostLikelyCovarianceAndMean(estimateCOV,estimateMean);
		TCLAP::SwitchArg arg_nologo("g","nologo","skip the logo at startup",cmd, false);
		TCLAP::SwitchArg arg_nosave("n","nosave","skip saving map images",cmd, false);
		TCLAP::SwitchArg arg_skip_icp("s","noicp","skip ICP optimization stage",cmd, false);

		// Parse arguments:
		if (!cmd.parse( argc, argv ))
		}

		SKIP_ICP_STAGE = arg_skip_icp.getValue();
		NOISE_IN_POSE  = arg_noise_pose.getValue();
		NOISE_IN_LASER = arg_noise_laser.getValue();


<MSG> another cmd line flag for grid-matching app

<DFF> @@ -64,6 +64,7 @@ bool	SAVE_CORR_AND_NONCORR_DISTS;
 bool	IS_VERBOSE;
 bool	NOSAVE=false;
 bool	SKIP_ICP_STAGE=false;
+bool	MOST_LIKELY_SOG_MODE_ONLY=false;
 
 string 	SAVE_ICP_GOODNESS_FIL;
 
@@ -324,7 +325,7 @@ void do_grid_align()
 				CMatrixDouble33	estimateCOV;
 
 				// Get the mean, or the best Gassian mean in the case of a SOG:
-				if (IS_CLASS(parts,CPosePDFSOG))
+				if (IS_CLASS(parts,CPosePDFSOG) && MOST_LIKELY_SOG_MODE_ONLY)
 				{
 					CPosePDFSOGPtr pdf_SOG= CPosePDFSOGPtr( parts );
 					pdf_SOG->getMostLikelyCovarianceAndMean(estimateCOV,estimateMean);
@@ -700,6 +701,7 @@ int main(int argc, char **argv)
 		TCLAP::SwitchArg arg_nologo("g","nologo","skip the logo at startup",cmd, false);
 		TCLAP::SwitchArg arg_nosave("n","nosave","skip saving map images",cmd, false);
 		TCLAP::SwitchArg arg_skip_icp("s","noicp","skip ICP optimization stage",cmd, false);
+		TCLAP::SwitchArg arg_most_likely("","most-likely-only","Keep the most-likely Gaussian mode from the SOG",cmd, false);
 
 		// Parse arguments:
 		if (!cmd.parse( argc, argv ))
@@ -735,6 +737,7 @@ int main(int argc, char **argv)
 		}
 
 		SKIP_ICP_STAGE = arg_skip_icp.getValue();
+		MOST_LIKELY_SOG_MODE_ONLY = arg_most_likely.getValue();
 		NOISE_IN_POSE  = arg_noise_pose.getValue();
 		NOISE_IN_LASER = arg_noise_laser.getValue();
 

{'addition_count': 4, 'commit_subject': 'another cmd line flag for grid-matching app', 'deletion_count': 1, 'file_extension': '.cpp', 'lang': 'cpp', 'license': 'bsd-3-clause', 'repo_name': 'MRPT/mrpt'}