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

Services

services

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

  • services.foo.bar.compute_plan

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

  • services['/foo/bar'].compute_plan

ServiceNS instances

info(service.foo)

  • Returns ServiceInfo object. Equivalent to rosservice info foo.

str(service.foo)

  • Get service definition for service. Equivalent to rosservice type foo | rossrv show.

rostype(service.foo)

  • Get ServiceDefinition class for service.

services.foo(req)

  • Call service with req message and return response.

services.foo(key1=value1, key2=value2)

  • Call service using keyword arguments to create request message. Returns response.

services.foo(arg1, arg2...argN)

  • Call service using positional arguments to create request message. Returns response.

ServiceInfo instances

ServiceInfo instances are returned when you call info() on a ServiceNS instance.

str(service_info)

  • Print user-friendly information about NodeNS instance.

service_info.name

  • ROS name of service.

service_info.node

service_info.uri

  • ROSRPC URI of service.

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