diff --git a/roseus_bt/include/roseus_bt/command_line_argument_mapping.h b/roseus_bt/include/roseus_bt/command_line_argument_mapping.h index 7c4f4e3d0..484275c0c 100644 --- a/roseus_bt/include/roseus_bt/command_line_argument_mapping.h +++ b/roseus_bt/include/roseus_bt/command_line_argument_mapping.h @@ -8,6 +8,7 @@ #include #include #include +#include namespace roseus_bt @@ -19,6 +20,10 @@ bool parse_command_line(int argc, char** argv, const std::string& program_description, std::map& argument_map) { + + std::vector argv_vec; + ros::removeROSArgs(argc, argv, argv_vec); + std::string example_description = fmt::format("example:\n {0} --arg var1 hello --arg var2 world\n", argv[0]); @@ -29,7 +34,9 @@ bool parse_command_line(int argc, char** argv, "Initial blackboard variable-value pairs"); po::positional_options_description pos; - po::parsed_options parsed_options = po::command_line_parser(argc, argv). + // when initializing from std::vector, we need to drop the program name + po::parsed_options parsed_options = po::command_line_parser( + std::vector(argv_vec.begin() + 1, argv_vec.end())). options(desc). positional(pos). style(po::command_line_style::unix_style ^ po::command_line_style::allow_short).