mvsim-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 <mvsim/Comms/ports.h>
14 
15 #include <functional>
16 #include <memory>
17 
18 // We need all TCLAP objects to be initialized in order for all translation
19 // units, that is why we use this holder structure:
20 struct cli_flags
21 {
22  TCLAP::CmdLine cmd{"mvsim", ' ', "version", false /* no --help */};
23 
24  TCLAP::UnlabeledMultiArg<std::string> argCmd{
25  "command", "Command to run. Run 'mvsim help' to list commands.", false,
26  "", cmd};
27 
28  TCLAP::ValueArg<std::string> argVerbosity{
29  "v", "verbose", "Verbosity level",
30  false, "INFO", "ERROR|WARN|INFO|DEBUG",
31  cmd};
32 
33  TCLAP::SwitchArg argFullProfiler{
34  "", "full-profiler",
35  "Enable saving *all* timing data, dumping it to a file at the end of "
36  "the "
37  "program.",
38  cmd};
39 
40  TCLAP::SwitchArg argHeadless{
41  "", "headless", "Runs the simulator without any GUI window.", cmd};
42 
43  TCLAP::SwitchArg argDetails{
44  "", "details", "Shows details in the specified subcommand", cmd};
45 
46  TCLAP::SwitchArg argVersion{
47  "", "version", "Shows program version and exits", cmd};
48 
49  TCLAP::SwitchArg argHelp{
50  "h", "help", "Shows more detailed help for command", cmd};
51 
52  TCLAP::ValueArg<int> argPort{
53  "p",
54  "port",
55  "TCP port to listen at",
56  false,
58  "TCP port",
59  cmd};
60 
61  TCLAP::ValueArg<double> argRealTimeFactor{
62  "",
63  "realtime-factor",
64  "Realtime modification factor: <1 slower than real-time, >1 faster "
65  "than real-time",
66  false,
67  1.0,
68  "1.0",
69  cmd};
70 };
71 
72 extern std::unique_ptr<cli_flags> cli;
73 
74 using cmd_t = std::function<int(void)>;
75 
76 int printListCommands(); // "help"
77 void printVersion(); // "--version"
78 int launchStandAloneServer(); // "server"
79 int launchSimulation(); // "launch"
80 int commandNode(); // "node"
81 int commandTopic(); // "topic"
82 
85 
86 void commonLaunchServer();
TCLAP::SwitchArg argHeadless
Definition: mvsim-cli.h:40
int launchSimulation()
void printVersion()
TCLAP::ValueArg< double > argRealTimeFactor
Definition: mvsim-cli.h:61
int commandTopic()
TCLAP::SwitchArg argDetails
Definition: mvsim-cli.h:43
std::function< int(void)> cmd_t
Definition: mvsim-cli.h:74
TCLAP::SwitchArg argFullProfiler
Definition: mvsim-cli.h:33
TCLAP::SwitchArg argVersion
Definition: mvsim-cli.h:46
void setConsoleNormalColor()
TCLAP::SwitchArg argHelp
Definition: mvsim-cli.h:49
int printListCommands()
std::unique_ptr< cli_flags > cli
TCLAP::ValueArg< std::string > argVerbosity
Definition: mvsim-cli.h:28
int commandNode()
TCLAP::ValueArg< int > argPort
Definition: mvsim-cli.h:52
constexpr unsigned int MVSIM_PORTNO_MAIN_REP
Definition: ports.h:17
TCLAP::UnlabeledMultiArg< std::string > argCmd
Definition: mvsim-cli.h:24
void setConsoleErrorColor()
TCLAP::CmdLine cmd
Definition: mvsim-cli.h:22
void commonLaunchServer()
int launchStandAloneServer()


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:21