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