Names

Graph Resource Names

Graph Resource Names はROS Computation Graphのすべてのリソースに使用される階層的な命名構造を提供します、Nodesや、Parametersや、Topicsや、Servicesなどのように。 これらの名前はROSで大きく複雑なシステムを組むにあたって非常に強力かつ中心的なものです。 つまり、これらの名前がどのように働くか、あなたがどのように操るかか大切となります。

ここで、いくつかの例を示します。

  • / (the global namespace)

  • /foo

  • /stanford/robot/name

  • /wg/node1

Graph Resource Namesはカプセル化を提供するためのROSの重要なメカニズムです。 各リソースは名前空間の中で定義されます。それは他の多くのリソースと名前空間を共有するかもしれません。 一般に、リソースはそれらの名前空間の中でリソースを作成できます、そして、それらは名前空間以内かそれら自身の名前空間を超えてリソースにアクセスできます。 異なった名前空間におけるリソースの間でコネクションを作ることができます。しかし、両方の名前空間を統合してしまう危険性を秘めています。 このカプセル化は、アクシデント的に違う場所で間違った名前が使われたり、グローバルが名前をハイジャックしたりすることから分離します。

名前はrelativelyに保存されます。よってリソースはどのネームスペースにいるかを気にしなくてもよい。 このシンプルなコードはトップレベルのネームスペースですべての仕事をする場合にうまく動くだろう。 これらのこまごまとしたシステムを統合してもっと大きなシステムにする場合、彼らのコードは定義する名前空間まで潜って行くことができます。 例えば、1つは、スタンフォードデモとWillow Garageデモを取って、stanfordとwgのサブグラフで新しいデモにそれらを合併するかもしれません。 両方のデモでNodeを'camera'と命名するなら、それらは競合を起こしません。ツールやパラメータはトップレベルに作ることで、すべてから見ることができるようになります。

Valid Names

A valid name has the following characteristics:

  1. First character is an alpha character ([a-z|A-Z]), tilde (~) or forward slash (/)

  2. Subsequent characters can be alphanumeric ([0-9|a-z|A-Z]), underscores (_), or forward slashes (/)

Exception: base names (described below) cannot have forward slashes (/) or tildes (~) in them.

Resolving

There are four types of Graph Resource Names in ROS: base, relative, global, and private, which have the following syntax:

  • base

  • relative/name

  • /global/name

  • ~private/name

By default, resolution is done relative to the node's namespace. For example, the node /wg/node1 has the namespace /wg, so the name node2 will resolve to /wg/node2.

Names with no namespace qualifiers whatsoever are base names. Base names are actually a subclass of relative names and have the same resolution rules. Base names are most frequently used to initialize the node name.

Names that start with a "/" are global -- they are considered fully resolved. Global names should be avoided as much as possible as they limit code portability.

Names that start with a "~" are private. They convert the node's name into a namespace. For example, node1 in namespace /wg/ has the private namespace /wg/node1. Private names are useful for passing parameters to a specific node via the parameter server.

Relative (default) name resolution examples:

  • If node node1 in the global / namespace accesses the resource bar, that will resolve to the name /bar.

  • If node node2 in the /wg/ namespace accesses the resource foo, that will resolve to the name /wg/foo.

  • If node node3 in the /wg/ namespace accesses the resource foo/bar, that will resolve to the name /wg/foo/bar.

Global name resolution examples:

  • If node node1 in the global / namespace accesses the resource /bar, that will resolve to the name /bar.

  • If node node2 in the /wg/ namespace accesses the resource /foo, that will resolve to the name /foo.

  • If node node3 in the /wg/ namespace accesses the resource /foo/bar, that will resolve to the name /foo/bar.

Private name resolution examples:

  • If node node1 in the global / namespace accesses the resource ~bar, that will resolve to the name /node1/bar.

  • If node node2 in the /wg/ namespace accesses the resource ~foo, that will resolve to the name /wg/node2/foo.

  • If node node3 in the /wg/ namespace accesses the resource ~foo/bar, that will resolve to the name /wg/node3/foo/bar.

Remapping

Any name within a ROS Node can be remapped when the Node is launched at the command-line. For more information on this feature, see Remapping Arguments.

Package Resource Names

Package Resource Names are used in ROS with Filesystem-Level concepts to simplify the process of referring to files and data types on disk. Package Resource Names are very simple: they are just the name of the Package that the resource is in plus the name of the resource. For example, the name "std_msgs/String" refers to the "String" message type in the "std_msgs" Package.

Some of the ROS-related files that may be referred to using Package Resource Names include:

Package Resource Names are very similar to file paths, except they are much shorter. This is due to the ability of ROS to locate Packages on disk and make additional assumptions about their contents. For example, Message descriptions are always stored in the msg subdirectory and have the .msg extension, so std_msgs/String is shorthand for path/to/std_msgs/msg/String.msg. Similarly, the Node type foo/bar is equivalent to searching for a file named bar in Package foo with executable permissions.

Wiki: ja/Names (last edited 2010-01-15 17:00:28 by YoshinoriNakajima)