From 2f6ad92acc1c0a5a5a6e78c8fb45b74100291fc4 Mon Sep 17 00:00:00 2001 From: "David V. Lu!!" Date: Tue, 15 Mar 2022 09:20:10 -0400 Subject: [PATCH] [MSA] Fix arg parsing in main (#1110) --- .../moveit_setup_assistant/src/main.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/moveit_setup_assistant/moveit_setup_assistant/src/main.cpp b/moveit_setup_assistant/moveit_setup_assistant/src/main.cpp index e999b7da03..421f9ca5d4 100644 --- a/moveit_setup_assistant/moveit_setup_assistant/src/main.cpp +++ b/moveit_setup_assistant/moveit_setup_assistant/src/main.cpp @@ -55,6 +55,14 @@ void usage(boost::program_options::options_description& desc, int exit_code) int main(int argc, char** argv) { + std::vector remaining_args = rclcpp::remove_ros_arguments(argc, argv); + std::vector clean_argv; + clean_argv.reserve(remaining_args.size()); + for (const std::string& arg : remaining_args) + { + clean_argv.push_back(const_cast(arg.c_str())); + } + // Parse parameters namespace po = boost::program_options; @@ -70,7 +78,7 @@ int main(int argc, char** argv) po::variables_map vm; try { - po::store(po::parse_command_line(argc, argv, desc), vm); + po::store(po::parse_command_line(clean_argv.size(), &clean_argv[0], desc), vm); po::notify(vm); if (vm.count("help"))