Rosanswers logo

I have a launcher with some arguments, so I expect to launch it like this

roslaunch my_package my_launcher.launch my_argument:=some_value

Is there a way to get the value of "my_argument" ("some_value" as a string or number if it's a number) from the node code?

I want to do something like this:

std::string my_value = ros::launch::?????::get_arg("my_argument");

Thanks in advance

Originally posted by crpizarr on ROS Answers with karma: 229 on 2014-07-01

Post score: 0

Original comments

Comment by McMurdo on 2014-07-01:
You can get this argument in the launch file and send it over to the node you are starting. From the node you will get it as the args[] from (int argn, char *args[]).

Doing it directly isn't possible I guess.


1 Answer 1


Rosanswers logo


Originally posted by McMurdo with karma: 1247 on 2014-07-01

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.