rosrun string parameter syntax
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.
Private parameters have to be read this way: http://www.ros.org/wiki/roscpp/Overview/Parameter%20Server#Accessing_Private_Parameters
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.
have you tried itoa() ? http://www.cplusplus.com/reference/cstdlib/itoa/
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.