Ask Your Question
1

array of strings as param tag in launch file

asked 2018-01-27 20:14:41 -0600

2ROS0 gravatar image

updated 2018-01-27 20:15:29 -0600

Hi,

I'm trying to read an array of strings into my ros node. Here is the line in my launch file <param name="string_list" value="[this, is, a, string, array]"/>

And here is the nh.getParam() call in my node

ros::NodeHandle nh("~");`

std::vector<std::string> string_list;

nh.getParam("string_list", string_list);

I know that the param is there when I do a rosparam list. And i know the namespaces are correct since it works with a simple int param. But in this case with a vector of strings, when I read the string_list after the getParam() call, it is of 0 length

What am I doing wrong?

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-01-28 03:13:54 -0600

gvdhoorn gravatar image

Please see #q194592, especially the answer by @peci1.

edit flag offensive delete link more

Comments

<arg name="string_list" default="[this, is, list]"/><rosparam param="string_list" subst_value="True">$(arg string_list)</rosparam>

This shows the following error: requires the 'string_list' arg to be set

2ROS0 gravatar image2ROS0 ( 2018-01-28 17:45:10 -0600 )edit

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

Stats

Asked: 2018-01-27 20:14:41 -0600

Seen: 2,071 times

Last updated: Jan 28 '18