rosh overview: Roshlets | Basics | Messages | Parameters | Topics | Services | Nodes | Topic Tools | Packages | Bags | Bagys | roslaunch

Nodes

nodes

The nodes object provides you access to all active ROS nodes in your system. This object follows the general ROSH convention for converting ROS names, i.e. to access the node /foo/bar/driver, you would use:

  • nodes.foo.bar.driver

You can also use mapping-style lookups on nodes, which is useful if you are dealing with string names:

  • nodes['/foo/bar'].driver

NodeNS instances

nodes.foo()

  • Returns True if the node is up. Equivalent to rosnode ping foo.

info(nodes.foo)

  • Returns a NodeInfo object. Equivalent to rosnode info foo.

kill(nodes.foo)

  • Kill node. Equivalent to rosnode kill foo.

NodeInfo instances

NodeInfo instances are returned when you call info() on a NodeNS instance.

str(node_info)

  • Print user-friendly information on Node publications, subscriptions, and services.

node_info.pubs

  • Topics that the node publishes. These can be used like normal topic instances. Example:

    node_info.pubs.rosout(msg="Hello world")

node_info.subs

  • Topics that the node subscribes to. These can be used like normal topic instances.

node_info.srvs

  • Services that the node subscribes to. These can be used like normal service instances.

list(node_info.pubs), list(node_info.subs), list(node_info.srvs)

  • Convert to list.

Wiki: rosh/Overview/Nodes (last edited 2010-10-22 17:33:18 by KenConley)