Utilities¶
This page documents the utility functions provided by Skarv.
Periodic Execution¶
skarv.utilities.call_every(seconds: float, wait_first: bool = False)
¶
Decorator to repeatedly call a function every specified number of seconds.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
seconds
|
float
|
The interval in seconds between calls. |
required |
wait_first
|
bool
|
If True, wait for the interval before the first call. Defaults to False. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
Callable |
A decorator that schedules the function to be called periodically. |
Source code in skarv/utilities/__init__.py
Zenoh Integration¶
skarv.utilities.zenoh.mirror(zenoh_session: zenoh.Session, zenoh_key: str, skarv_key: str)
¶
Mirror a Zenoh key expression to a Skarv key.
Subscribes to the Zenoh key expression and automatically puts received values into Skarv. If the Zenoh key already has a value, it fetches and stores it in Skarv (if not already present).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
zenoh_session
|
Session
|
The Zenoh session to use. |
required |
zenoh_key
|
str
|
The Zenoh key expression to subscribe to. |
required |
skarv_key
|
str
|
The Skarv key to store values in. |
required |