(訳注:最新の情報は原文を参照してください.)
ノードハンドルからプライベートネームで接続する
Why not just ~name?
The introduction of NodeHandles in roscpp created something of a conundrum when dealing with private names. If I create a NodeHandle with its own namespace:
Where should a private name resolve? Some options would be:
/my_node_handle_namespace/my_node_name/name
my_node_name/my_node_handle_namespace/name
/my_node_handle_namespace/name
- Something else entirely
For this reason, NodeHandle does not allow passing private names directly to its methods, or to constructors that take a NodeHandle as an argument.
Accessing Private Names
The solution is to construct a NodeHandle with a private name as its namespace:
nh1's namespace is /my_node_name, and nh2's namespace is /my_node_name/foo.
So instead of doing this:
You do this: