ros_sugar.robot.transports.sdk#
Vendor-SDK callback transport for robot plugins.
Module Contents#
Classes#
Generic shim around a vendor SDK’s listener/sender API. |
API#
- class ros_sugar.robot.transports.sdk.SdkCallbackTransport(name: str, *, register_fn: Optional[Callable[[Callable[[Any], None]], Any]] = None, unregister_fn: Optional[Callable[[Any], None]] = None, send_fn: Optional[Callable[[Any], Any]] = None, **kwargs)#
Bases:
ros_sugar.robot.transports.TransportGeneric shim around a vendor SDK’s listener/sender API.
The plugin author passes the SDK’s “register a listener” function, its matching “unregister” function, and a “send” function. The transport wires the SDK’s inbound callback to
_dispatchso feedback decoders see each SDK object.- Parameters:
name (str) – Unique transport name.
register_fn (Optional[Callable[[Callable[[Any], None]], Any]]) –
register_fn(callback)— hands the SDK a callable it invokes with each inbound message; may return a handle.unregister_fn (Optional[Callable[[Any], None]]) –
unregister_fn(handle)— undoesregister_fn.send_fn (Optional[Callable[[Any], Any]]) –
send_fn(payload)— sends a command through the SDK.
- open() None#
Register the inbound callback with the SDK.
- open_egress() None#
Sending only needs
send_fn; nothing to register.
- close() None#
Unregister the inbound callback.
- send(payload: Any) bool#
Send
payloadthrough the SDK’s send function.
- is_open() bool#
- subscribe(on_msg: Callable[[Any], None]) ros_sugar.robot.transports.SubscriptionHandle#
- property kind: str#