synchros2.futures module
- class synchros2.futures.FutureConvertible[source]
Bases:
Awaitable[T],Protocol[T]An awaitable that is convertible to a future-like object.
- __init__(*args, **kwargs)
- as_future() FutureLike[T][source]
Get future-like view.
- class synchros2.futures.FutureLike[source]
Bases:
Awaitable[T],Protocol[T]A future-like awaitable object.
Matches rclpy.task.Future and concurrent.futures.Future protocols.
- __init__(*args, **kwargs)
- synchros2.futures.as_proper_future(instance: FutureLike | FutureConvertible) FutureLike[source]
Return instance as a proper future-like object.
- synchros2.futures.unwrap_future(future: FutureLike | FutureConvertible, timeout_sec: float | None = None, *, clock: rclpy.clock.Clock | None = None, context: rclpy.context.Context | None = None) Any[source]
Fetch future result when it is done.
Note this function may block and may raise if the future does or it times out waiting for it. See wait_for_future() documentation for further reference on arguments taken.
- synchros2.futures.wait_and_return_result(future: FutureLike | FutureConvertible, timeout_sec: float | None = None, *, clock: rclpy.clock.Clock | None = None, context: rclpy.context.Context | None = None) Any
Fetch future result when it is done.
Alias for unwrap_future().
- synchros2.futures.wait_for_future(future: FutureLike | FutureConvertible, timeout_sec: float | None = None, *, clock: rclpy.clock.Clock | None = None, context: rclpy.context.Context | None = None) bool[source]
Block while waiting for a future to become done
- Parameters:
future (Future) – The future to be waited on
timeout_sec (Optional[float]) – An optional timeout for how long to wait
clock (otherwise the system) – An optional clock to use for timeout waits,
any (defaults to the clock of the current scope if)
clock
context (Optional[Context]) – Current context (will use the default if none is given)
- Returns:
True if successful, False if the timeout was triggered
- Return type: