src
main.cpp
Go to the documentation of this file.
1
// Fancy rosbag terminal UI
2
// Author: Max Schwarz <max.schwarz@uni-bonn.de>
3
4
#include <boost/program_options.hpp>
5
6
#include <
ros/init.h
>
7
8
#include <
rosfmt/full.h
>
9
10
// Implemented in cmd_*.cpp
11
int
record
(
const
std::vector<std::string>& options);
12
int
info
(
const
std::vector<std::string>& options);
13
int
play
(
const
std::vector<std::string>& options);
14
int
test
(
const
std::vector<std::string>& options);
15
16
int
main
(
int
argc,
char
** argv)
17
{
18
ros::init
(argc, argv,
"rosbag_fancy"
,
ros::init_options::AnonymousName
);
19
20
auto
usage
= [](std::FILE*
f
){
21
fmt::print(
f
,
22
"Usage: rosbag_fancy <command> [args]\n\n"
23
"Available commands:\n"
24
" record: Record a bagfile\n"
25
" info: Display information about a bagfile\n"
26
" play: Play bagfile\n"
27
" test: Run internal unit-tests\n"
28
"\n"
29
"See rosbag_fancy <command> --help for command-specific instructions.\n"
30
"\n"
31
);
32
};
33
34
if
(argc < 2)
35
{
36
usage
(stderr);
37
return
1;
38
}
39
40
std::string
cmd
= std::string(argv[1]);
41
std::vector<std::string> arguments(argc - 2);
42
std::copy(argv + 2, argv + argc, arguments.begin());
43
44
if
(
cmd
==
"-h"
||
cmd
==
"--help"
)
45
{
46
usage
(stdout);
47
return
0;
48
}
49
50
if
(
cmd
==
"record"
)
51
return
record
(arguments);
52
else
if
(
cmd
==
"info"
)
53
return
info
(arguments);
54
else
if
(
cmd
==
"play"
)
55
return
play
(arguments);
56
else
if
(
cmd
==
"test"
)
57
return
test
(arguments);
58
else
59
{
60
fmt::print(stderr,
"Unknown command {}, see --help\n"
,
cmd
);
61
return
1;
62
}
63
64
return
0;
65
}
66
ros::init_options::AnonymousName
AnonymousName
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
play
int play(const std::vector< std::string > &options)
Definition:
cmd_play.cpp:29
init.h
main
int main(int argc, char **argv)
Definition:
main.cpp:16
f
f
info
int info(const std::vector< std::string > &options)
Definition:
cmd_info.cpp:19
test
int test(const std::vector< std::string > &options)
Definition:
cmd_test.cpp:9
full.h
record
int record(const std::vector< std::string > &options)
Definition:
cmd_record.cpp:27
cmd
string cmd
usage
def usage(progname)
rosbag_fancy
Author(s):
autogenerated on Tue Feb 20 2024 03:20:59