Ask Your Question

roscpp roslaunch get arguments

asked 2014-07-01 09:52:28 -0500

crpizarr gravatar image

updated 2014-07-01 09:54:01 -0500

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

edit retag flag offensive close merge delete


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.

McMurdo gravatar image McMurdo  ( 2014-07-01 10:01:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2014-07-01 10:02:13 -0500

McMurdo gravatar image

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-07-01 09:52:28 -0500

Seen: 1,216 times

Last updated: Jul 01 '14