rosros 0.2.5
Simple unified interface to ROS1 / ROS2 Python API
Loading...
Searching...
No Matches
rosros.rospify.service.Service Class Reference

Stand-in for `rospy.Service`, wrapping the creation of ROS2 service. More...

Inheritance diagram for rosros.rospify.service.Service:
Inheritance graph

Public Member Functions

 __new__ (cls, name, service_class, handler, buff_size=None, error_handler=None)
 Returns rclpy.service.Service instance.
 
 __subclasshook__ (cls, C)
 Returns true if C is a ROS2 service server class, else `NotImplemented`.
 

Detailed Description

Stand-in for `rospy.Service`, wrapping the creation of ROS2 service.

Definition at line 89 of file service.py.

Member Function Documentation

◆ __new__()

rosros.rospify.service.Service.__new__ (   cls,
  name,
  service_class,
  handler,
  buff_size = None,
  error_handler = None 
)

Returns rclpy.service.Service instance.

Parameters
nameservice name, absolute or relative
service_classservice definition class
handlercallback function for processing service request. Function takes in a ServiceRequest and returns a ServiceResponse of the appropriate type. Function may also return a list, tuple, or dictionary with arguments to initialize a ServiceResponse instance of the correct type. If handler cannot process request, it may either return None, to indicate failure, or it may raise a rospify.ServiceException to send a specific error message to the client. Returning None is always considered a failure.
buff_sizeignored (ROS1 compatibility stand-in)
error_handlercallback function for handling errors raised in the service code, as fn(exception, exception_type, exception_value, traceback)

Definition at line 109 of file service.py.

◆ __subclasshook__()

rosros.rospify.service.Service.__subclasshook__ (   cls,
  C 
)

Returns true if C is a ROS2 service server class, else `NotImplemented`.

Definition at line 124 of file service.py.


The documentation for this class was generated from the following file: