sm-cli.h
Go to the documentation of this file.
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2023 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/3rdparty/tclap/CmdLine.h>
13 #include <mrpt/maps/CSimpleMap.h>
14 
15 #include <functional>
16 #include <memory>
17 #include <string>
18 
19 // We need all TCLAP objects to be initialized in order for all translation
20 // units, that is why we use this holder structure:
21 struct cli_flags
22 {
23  TCLAP::CmdLine cmd{"sm-cli", ' ', "version", false /* no --help */};
24 
25  TCLAP::UnlabeledMultiArg<std::string> argCmd{
26  "command", "Command to run. Run 'sm help' to list commands.", false, "", cmd};
27 
28  TCLAP::ValueArg<std::string> arg_verbosity_level{
29  "v", "verbosity", "Verbosity level: ERROR|WARN|INFO|DEBUG (Default: INFO)", false, "",
30  "INFO", cmd};
31 
32  TCLAP::ValueArg<size_t> arg_from{"", "from", "First KF index", false, 0, "KF index", cmd};
33 
34  TCLAP::ValueArg<size_t> arg_to{"", "to", "Last KF index", false, 0, "KF index", cmd};
35 
36  TCLAP::ValueArg<std::string> arg_min_corner{
37  "", "min-corner", "Bounding box minimum coordinates", false, "", "\"[xmin ymin zmin]\"",
38  cmd};
39 
40  TCLAP::ValueArg<std::string> arg_max_corner{
41  "", "max-corner", "Bounding box maximum coordinates", false, "", "\"[xmax ymax zmax]\"",
42  cmd};
43 
44  TCLAP::ValueArg<std::string> arg_output{"o", "output", "Output file", false, "output",
45  "output", cmd};
46 
47  TCLAP::ValueArg<std::string> arg_output_twist{
48  "",
49  "output-twist",
50  "Output file for twist (linear and angular velocity). Output file will "
51  "contain one row per frame, with these fields: "
52  "'time vx vy vz wx wy wz'",
53  false,
54  "",
55  "twist.txt",
56  cmd};
57 
58  TCLAP::SwitchArg argHelp{"h", "help", "Shows more detailed help for command", cmd};
59 
60  TCLAP::SwitchArg argVersion{"", "version", "Shows program version and exits", cmd};
61 };
62 
63 extern std::unique_ptr<cli_flags> cli;
64 
65 using cmd_t = std::function<int(void)>;
66 
67 int printListCommands(); // "help"
68 void printVersion(); // "--version"
69 int commandCut(); // "cut"
70 int commandInfo(); // "info"
71 int commandLevel(); // "level"
72 int commandTrim(); // "trim"
73 int commandJoin(); // "join"
74 int commandTf(); // "tf"
75 int commandExportKF(); // "export-keyframes"
76 int commandExportRawlog(); // "export-rawlog"
77 
78 mrpt::maps::CSimpleMap read_input_sm_from_cli(const std::string& fil);
79 
commandExportKF
int commandExportKF()
Definition: sm-cli-export-kfs.cpp:20
commandLevel
int commandLevel()
Definition: sm-cli-level.cpp:20
printListCommands
int printListCommands()
Definition: sm-cli-main.cpp:101
cli_flags::arg_output
TCLAP::ValueArg< std::string > arg_output
Definition: sm-cli.h:44
cli_flags::arg_verbosity_level
TCLAP::ValueArg< std::string > arg_verbosity_level
Definition: sm-cli.h:28
cli_flags::arg_to
TCLAP::ValueArg< size_t > arg_to
Definition: sm-cli.h:34
cli_flags::argHelp
TCLAP::SwitchArg argHelp
Definition: sm-cli.h:58
setConsoleNormalColor
void setConsoleNormalColor()
Definition: sm-cli-main.cpp:48
commandTf
int commandTf()
Definition: sm-cli-tf.cpp:20
commandCut
int commandCut()
Definition: sm-cli-cut.cpp:17
testing::internal::string
::std::string string
Definition: gtest.h:1979
cmd_t
std::function< int(void)> cmd_t
Definition: sm-cli.h:65
cli_flags::arg_min_corner
TCLAP::ValueArg< std::string > arg_min_corner
Definition: sm-cli.h:36
commandInfo
int commandInfo()
Definition: sm-cli-info.cpp:19
cli_flags::argVersion
TCLAP::SwitchArg argVersion
Definition: sm-cli.h:60
cli_flags::arg_max_corner
TCLAP::ValueArg< std::string > arg_max_corner
Definition: sm-cli.h:40
cli_flags::arg_from
TCLAP::ValueArg< size_t > arg_from
Definition: sm-cli.h:32
commandJoin
int commandJoin()
Definition: sm-cli-join.cpp:17
cli
std::unique_ptr< cli_flags > cli
Definition: sm-cli-main.cpp:29
cli_flags::cmd
TCLAP::CmdLine cmd
Definition: sm-cli.h:23
cli_flags
Definition: sm-cli.h:21
printVersion
void printVersion()
Definition: sm-cli-main.cpp:110
cli_flags::argCmd
TCLAP::UnlabeledMultiArg< std::string > argCmd
Definition: sm-cli.h:25
commandExportRawlog
int commandExportRawlog()
Definition: sm-cli-export-rawlog.cpp:23
cli_flags::arg_output_twist
TCLAP::ValueArg< std::string > arg_output_twist
Definition: sm-cli.h:47
setConsoleErrorColor
void setConsoleErrorColor()
Definition: sm-cli-main.cpp:43
read_input_sm_from_cli
mrpt::maps::CSimpleMap read_input_sm_from_cli(const std::string &fil)
Definition: sm-cli-main.cpp:113
commandTrim
int commandTrim()
Definition: sm-cli-trim.cpp:17


mp2p_icp
Author(s):
autogenerated on Mon May 26 2025 02:45:50