synchros2.service_handle module

class synchros2.service_handle.ServiceHandle[source]

Bases: object

A handle for the lifecycle of a service.

Handles getting a result after sending an ServiceRequest to Service as holding the various callbacks for sending an ServiceRequest (result, failure)

__init__(service_name: str, logger: rclpy.impl.rcutils_logger.RcutilsLogger | None = None, context: rclpy.context.Context | None = None)[source]

Constructor

Parameters:
  • service_name – The name of the service handle to be used in logging

  • logger – An optional ros logger

  • context – An optional ros context

property result: Any | None

Returns the result if one has been received from the service

set_on_failure_callback(on_failure_callback: Callable) None[source]

Set the callback to execute upon failure

set_result_callback(result_callback: Callable) None[source]

Sets the callback for when the future.result() completes.

set_send_service_future(send_service_future: rclpy.task.Future) None[source]

Sets the future received from sending the Action.Goal

wait(timeout_sec: float | None = None) bool[source]

Wait for service response, if any.