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

Cannot retrieve existing param

asked 2014-05-19 21:49:12 -0600

torsten gravatar image

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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-05-19 22:30:35 -0600

ahendrix gravatar image

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.

edit flag offensive delete link more

Comments

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

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

Question Tools

Stats

Asked: 2014-05-19 21:49:12 -0600

Seen: 1,574 times

Last updated: May 19 '14