22 #include <boost/program_options.hpp> 26 main(
int argc,
char** argv)
30 namespace po = boost::program_options;
31 po::options_description desc(
"Options");
33 (
"help",
"Print help messages")
34 (
"scan_topic", po::value<std::string>()->default_value(
"/scan") ,
"topic that contains the laserScan in the rosbag")
35 (
"bag_filename", po::value<std::string>()->required(),
"ros bag filename")
36 (
"seed", po::value<unsigned long int>()->default_value(0),
"seed")
37 (
"max_duration_buffer", po::value<unsigned long int>()->default_value(99999),
"max tf buffer duration")
38 (
"on_done", po::value<std::string>(),
"command to execute when done") ;
43 po::store(po::parse_command_line(argc, argv, desc),
48 if ( vm.count(
"help") )
50 std::cout <<
"Basic Command Line Parameter App" << std::endl
60 std::cerr <<
"ERROR: " << e.what() << std::endl << std::endl;
61 std::cerr << desc << std::endl;
65 std::string bag_fname = vm[
"bag_filename"].as<std::string>();
66 std::string scan_topic = vm[
"scan_topic"].as<std::string>();
67 unsigned long int seed = vm[
"seed"].as<
unsigned long int>();
68 unsigned long int max_duration_buffer = vm[
"max_duration_buffer"].as<
unsigned long int>();
75 if ( vm.count(
"on_done") )
78 system(vm[
"on_done"].as<std::string>().c_str());
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL void spin(Spinner &spinner)
void startReplay(const std::string &bag_fname, std::string scan_topic)
int main(int argc, char **argv)