Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSA] Fix arg parsing in main #1110

Merged
merged 1 commit into from
Mar 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion moveit_setup_assistant/moveit_setup_assistant/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ void usage(boost::program_options::options_description& desc, int exit_code)

int main(int argc, char** argv)
{
std::vector<std::string> remaining_args = rclcpp::remove_ros_arguments(argc, argv);
std::vector<char*> clean_argv;
clean_argv.reserve(remaining_args.size());
for (const std::string& arg : remaining_args)
{
clean_argv.push_back(const_cast<char*>(arg.c_str()));
}

// Parse parameters
namespace po = boost::program_options;

Expand All @@ -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"))
Expand Down