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

Revision history [back]

One example is when you have multiple nodes that have the same parameter (e.g. "frequency"). How do you set each node's parameter to be different?

In a launch file, when you do

<node pkg="some_package" type="some_executable" name="some_name" >
    <param name="param_name" value="some_value" />
</node>

the parameter gets resolved to /some-name/param_name.

In order to access the param_name without worrying about the node name you need to use

ros::NodeHandle nh_private("~");
std::string param;
nh_private.getParam("param_name", param);

otherwise you won't be able to get the parameter.

Hope it helps.