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, "",
27  cmd};
28 
29  TCLAP::ValueArg<std::string> arg_verbosity_level{
30  "v",
31  "verbosity",
32  "Verbosity level: ERROR|WARN|INFO|DEBUG (Default: INFO)",
33  false,
34  "",
35  "INFO",
36  cmd};
37 
38  TCLAP::ValueArg<size_t> arg_from{
39  "", "from", "First KF index", false, 0, "KF index", cmd};
40 
41  TCLAP::ValueArg<size_t> arg_to{"", "to", "Last KF index", false, 0,
42  "KF index", cmd};
43 
44  TCLAP::ValueArg<std::string> arg_min_corner{
45  "", "min-corner", "Bounding box minimum coordinates",
46  false, "", "\"[xmin ymin zmin]\"",
47  cmd};
48 
49  TCLAP::ValueArg<std::string> arg_max_corner{
50  "", "max-corner", "Bounding box maximum coordinates",
51  false, "", "\"[xmax ymax zmax]\"",
52  cmd};
53 
54  TCLAP::ValueArg<std::string> arg_output{
55  "o", "output", "Output file", false, "output", "output", cmd};
56 
57  TCLAP::ValueArg<std::string> arg_output_twist{
58  "",
59  "output-twist",
60  "Output file for twist (linear and angular velocity). Output file will "
61  "contain one row per frame, with these fields: "
62  "'time vx vy vz wx wy wz'",
63  false,
64  "",
65  "twist.txt",
66  cmd};
67 
68  TCLAP::SwitchArg argHelp{
69  "h", "help", "Shows more detailed help for command", cmd};
70 
71  TCLAP::SwitchArg argVersion{
72  "", "version", "Shows program version and exits", cmd};
73 };
74 
75 extern std::unique_ptr<cli_flags> cli;
76 
77 using cmd_t = std::function<int(void)>;
78 
79 int printListCommands(); // "help"
80 void printVersion(); // "--version"
81 int commandCut(); // "cut"
82 int commandInfo(); // "info"
83 int commandLevel(); // "level"
84 int commandTrim(); // "trim"
85 int commandJoin(); // "join"
86 int commandTf(); // "tf"
87 int commandExportKF(); // "export-keyframes"
88 int commandExportRawlog(); // "export-rawlog"
89 
90 mrpt::maps::CSimpleMap read_input_sm_from_cli(const std::string& fil);
91 
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:104
cli_flags::arg_output
TCLAP::ValueArg< std::string > arg_output
Definition: sm-cli.h:54
cli_flags::arg_verbosity_level
TCLAP::ValueArg< std::string > arg_verbosity_level
Definition: sm-cli.h:29
cli_flags::arg_to
TCLAP::ValueArg< size_t > arg_to
Definition: sm-cli.h:41
cli_flags::argHelp
TCLAP::SwitchArg argHelp
Definition: sm-cli.h:68
setConsoleNormalColor
void setConsoleNormalColor()
Definition: sm-cli-main.cpp:49
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:77
cli_flags::arg_min_corner
TCLAP::ValueArg< std::string > arg_min_corner
Definition: sm-cli.h:44
commandInfo
int commandInfo()
Definition: sm-cli-info.cpp:19
cli_flags::argVersion
TCLAP::SwitchArg argVersion
Definition: sm-cli.h:71
cli_flags::arg_max_corner
TCLAP::ValueArg< std::string > arg_max_corner
Definition: sm-cli.h:49
cli_flags::arg_from
TCLAP::ValueArg< size_t > arg_from
Definition: sm-cli.h:38
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:113
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:57
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:119
commandTrim
int commandTrim()
Definition: sm-cli-trim.cpp:17


mp2p_icp
Author(s):
autogenerated on Wed Oct 2 2024 02:45:25