Programmatically get node's Namespace
Is there a way to get a node's current namespace?
Say I launch a node like this
<launch>
<group ns="robot_1">
<node pkg="myrobot" type="robot" name="robot"/>
</group>
</launch>
then this node is really called /robot_1/robot
. Now what if it should publish something on a topic whose name depends on the namespace?
So in this case the topic may be /robot_1/control
.
Is there a way I can get my code to dynamically find this namespace?
Do you mean that you'd prefer to select that the node publishes in
/robot_1/robot
instead of/robot
?