# Cannot retrieve existing param

Hi, It seems I cannot retrieve an existing parameter using roscpp, neither using the node handle nor ros::param. What I want to do is access parameters of a different node. For example, let's consider a node A which wants to read the parameter of a node B, let's say move_base.

So in node A I want to read the parameter /move_base/local_costmap/height, for example. If I use

rosparam get /move_base/local_costmap/height


I get the value just fine. If I use in node A's code either

ros::NodeHandle n;
std::string param("/move_base/local_costmap/height"), param_value;
n.getParam(param,param_value);


or

std::string param("/move_base/local_costmap/height"), param_value;
ros::param::get(param,param_value);


I do not get the parameter. On the other hand both

ros::param::has(param);


and

nh.hasParam(param);


return 1. I know that this is not the preferred way of accessing other nodes' parameters. But I need it for documentation in a fixed setup. The limitations, .e.g, having to know a node's absolute path, are, in this case, acceptable. Can someone point me in the correct direction how to retrieve the param values or point out other ways how to retrieve parameter values for multiple nodes from one location using roscpp? I'd prefer not to use rosparam as it complicates things.

Thanks for you help.

edit retag close merge delete

Sort by » oldest newest most voted

Is it possible that this is failing because the parameter you're trying to retrieve is a double instead of a string?

If you need to handle parameters of unknown type, you may want to either use the xmlrpc variants of the parameter calls in C++, or write your node in python.

more

Ugh. I've tried pretty much everything concerning paths, handles, etc. But to check for the data type never occurred to me. Thanks.

( 2014-05-20 03:09:58 -0600 )edit