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

Stand-ins for `rospy.impl.tcpros_service` in ROS2. More...

Classes

class  Service
 Stand-in for `rospy.Service`, wrapping the creation of ROS2 service. More...
 
class  ServiceException
 Exception class for service-related errors. More...
 
class  ServiceProxy
 Stand-in for `rospy.ServiceProxy`, wrapping the creation of ROS2 service client. More...
 

Functions

 _wait_for_service (service, timeout=None, cls_or_typename=None)
 Blocks until service is available.
 
 wait_for_service (service, timeout=None)
 Blocks until service is available.
 

Detailed Description

Stand-ins for `rospy.impl.tcpros_service` in ROS2.

Function Documentation

◆ _wait_for_service()

rosros.rospify.service._wait_for_service (   service,
  timeout = None,
  cls_or_typename = None 
)
protected

Blocks until service is available.

Use this in initialization code if your program depends on a service already running.

Parameters
servicename of service
timeouttime to wait at most, as seconds or ROS duration; None or <0 waits forever
cls_or_typenameservice type to expect if any, as ROS service class object like `std_msgs.msg.Bool` or service type name like "std_srvs/SetBool"
Exceptions
ROSExceptionif specified timeout is exceeded
ROSInterruptExceptionif shutdown interrupts wait

Definition at line 59 of file service.py.

◆ wait_for_service()

rosros.rospify.service.wait_for_service (   service,
  timeout = None 
)

Blocks until service is available.

Use this in initialization code if your program depends on a service already running.

Parameters
servicename of service
timeouttimeout time in seconds or Duration, None for no timeout.
Note
timeout=0 is invalid as wait_for_service actually contacts the service, so non-blocking behavior is not possible. For timeout=0 use cases, just call the service without waiting.
Exceptions
ROSExceptionif specified timeout is exceeded
ROSInterruptExceptionif shutdown interrupts wait

Definition at line 37 of file service.py.