ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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;


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

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




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

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


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

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: 2014-05-19 21:49:12 -0600

Seen: 1,352 times

Last updated: May 19 '14