Ask Your Question
0

Query rosparam for public/private status

asked 2017-08-18 19:34:14 -0600

dinosaur gravatar image

Can the rosparam command line tool tell me whether a parameter is private or public? If so, how?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-08-18 22:24:53 -0600

Ed Venator gravatar image

"Private" parameters aren't really "private." The concept of private parameters is just useful for bookkeeping. The "private" namespace of a node is just the namespace that has the same path as the node. The parameter server doesn't hide private parameters from other nodes.

You could, perhaps, infer that a parameter is private if there exists a node whose ROS graph path is a prefix of the parameter. However, this would be prone to errors. For example, the following launch file is valid:

<launch>
<node name="my_node" pkg="my_pkg" type="my_exe" />
<group ns="my_node">
    <param name="my_private_param" value="foo"/>
    <node name="my_inception_node" pkg="my_pkg" type="my_other_exe">
        <param name="my_super_private_param" value="foo"/>
    </node>
</group>
<node name="another_node" pkg="my_pkg" type="yet_another_exe"/>
</launch>

The parameter /my_node/my_private_param is private to /my_node, but it's public to /my_node/my_inception_node. Even /another_node can see that parameter by querying the fully-qualified path, i.e. /my_node/my_private_param.

edit flag offensive delete link more

Comments

While there is no explicit hiding, I don't believe that you can say that:

parameter /my_node/my_private_param is private to /my_node, but it's public to /my_node/my_inception_node.

private parameters are private to the node by definition. The fact that my_inception_node lives in the ..

gvdhoorn gravatar imagegvdhoorn ( 2017-08-19 05:21:37 -0600 )edit

.. same namespace doesn't change that fact.

If you create a private NodeHandle in my_inception_node, it will (should) not be able to find my_private_param.

gvdhoorn gravatar imagegvdhoorn ( 2017-08-19 05:22:42 -0600 )edit

My point is that there is such a thing as a private NodeHandle, but no such thing as a private parameter. You can create a NodeHandle scoped to any namespace you like. A private NodeHandle is just a special case where you create a NodeHandle scoped to the path of the node.

Ed Venator gravatar imageEd Venator ( 2017-08-19 17:38:23 -0600 )edit

You're correct that a private NodeHandle in my_inception_node can't find /my_node/my_private_param. That's what I meant when I called it "public" in that context.

Ed Venator gravatar imageEd Venator ( 2017-08-19 17:40:45 -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

2 followers

Stats

Asked: 2017-08-18 19:34:14 -0600

Seen: 93 times

Last updated: Aug 18 '17