Ask Your Question

rosrun string parameter syntax

asked 2012-11-29 03:41:28 -0500

Okan Aşık gravatar image

I am trying to read an integer parameter as string however ros::param::get() does not read it.

std::string my_param;
if (ros::param::get("~x", my_param)) {
   ROS_INFO("value=%s", my_param.c_str());

rosrun planning planner _x:=12
rosrun planning planner _x:="12"

It cannot read parameters either way.

edit retag flag offensive close merge delete


Miquel Massot gravatar image Miquel Massot  ( 2012-11-29 09:07:07 -0500 )edit

my code reads private parameters same as tutorial, but i want to read the parameter as string. isn't that possible when I write numbers.

Okan Aşık gravatar image Okan Aşık  ( 2012-11-30 05:17:32 -0500 )edit
Miquel Massot gravatar image Miquel Massot  ( 2012-12-18 04:54:03 -0500 )edit

I solved my problem, but I just want to speculate that there might be a bug or a better explanation for such an unexpected case.

Okan Aşık gravatar image Okan Aşık  ( 2012-12-19 00:59:02 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-02-21 12:52:59 -0500

Claudio gravatar image

I hit on this too: programs must know in advance the type of the parameter they are fetching, otherwise they may end up getting nothing from the server. And there is no way to check the parameter type.

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


Asked: 2012-11-29 03:41:28 -0500

Seen: 1,230 times

Last updated: Nov 29 '12