ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

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

Comments

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
1

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

McMurdo gravatar image

http://answers.ros.org/question/29461/roslaunch-with-arguments/

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 1,627 times

Last updated: Jul 01 '14