First time here? Check out the FAQ!


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

rosrun string parameter syntax

asked Nov 29 '12

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.

Preview: (hide)

Comments

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  ( Nov 30 '12 )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  ( Dec 19 '12 )edit

1 Answer

Sort by » oldest newest most voted
0

answered Feb 21 '13

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.

Preview: (hide)

Question Tools

Stats

Asked: Nov 29 '12

Seen: 1,321 times

Last updated: Nov 29 '12