.. _app_sm2mm:

===============================
Application: ``sm2mm``
===============================

**Convert a `*.simplemap` file into a `*.mm` metric map using a pipeline configuration.**

.. contents::
   :local:


Synopsis
--------

The `sm2mm` command-line tool is a utility from the `mp2p_icp` project designed to transform a "simple map" file, a "key-frame map" typically generated by a SLAM system and having the `.simplemap` extension, 
into a "metric map" file (`.mm` extension). Recall that metric maps in mp2p_icp can have :ref:`multiple map layers <mp2p_icp_basics>`.
This conversion is performed by applying a user-defined processing pipeline, specified in a configuration file, to the simple map data.

This tool is for post-processing SLAM outputs, enabling the generation of detailed and structured metric representations of the environment suitable for various applications, such as navigation, visualization, or further geometric analysis.

.. note::

    Pipeline files are explained in :ref:`this page <sm2mm_pipelines>`, together with examples.


CLI Reference
-------------

.. code-block:: bash

    USAGE: 

    sm2mm  [--to-index <0>] [--from-index <0>] [--profiler]
            [--no-progress-bar] [--externals-dir <<ExternalsDirectory>>] [-v
            <INFO>] [-p <pipeline.yaml>] [-l <foobar.so>] -o <out.mm> -i
            <map.simplemap> [--] [--version] [-h]


    Where: 

    --to-index <0>
        If provided, the simplemap keyframes will be processed up to this
        index only.

    --from-index <0>
        If provided, the simplemap keyframes until this index will be
        discarded and it will start at this point.

    --profiler
        Enables profiler.

    --no-progress-bar
        Disables the progress bar. Useful for cleaner output when using DEBUG
        verbosity level.

    --externals-dir <<ExternalsDirectory>>
        Lazy-load base directory for datasets with externally-stored
        observations

    -v <INFO>,  --verbosity <INFO>
        Verbosity level: ERROR|WARN|INFO|DEBUG (Default: INFO)

    -p <pipeline.yaml>,  --pipeline <pipeline.yaml>
        YAML file with the mp2p_icp_filters pipeline to load. It can
        optionally contain a `filters:`, a `generators:`, and a
        `final_filters:` sections. If this argument is not provided, the
        default generator will be used and no filtering will be applied, which
        might be ok in some cases. See the app README for
        examples:

        https://github.com/MOLAorg/mp2p_icp/tree/develop/apps/sm2mm

    -l <foobar.so>,  --load-plugins <foobar.so>
        One or more (comma separated) *.so files to load as plugins, e.g.
        defining new CMetricMap classes

    -o <out.mm>,  --output <out.mm>
        (required)  Output .mm file to write to

    -i <map.simplemap>,  --input <map.simplemap>
        (required)  Input .simplemap file

    --,  --ignore_rest
        Ignores the rest of the labeled arguments following this flag.

    --version
        Displays version information and exits.

    -h,  --help
        Displays usage information and exits.




