sim2bot.Robot.on_telemetry¶
on_telemetry(callback: Optional[Callable[[RobotState], None]]) -> None
¶
Register or clear a callback for every received robot-state packet.
Parameters:
-
callback(Optional[Callable[[RobotState], None]]) –Function receiving one
RobotState, orNoneto unregister the current callback.
Returns:
-
None–Registration takes effect immediately.
Warning
The callback runs on the SDK reader thread. Keep it short and thread-safe; hand work to your own queue rather than blocking it.
Source code in sim2bot/client.py
Practical examples¶
Examples use objects discovered from the current scene rather than hard-coded robot metadata.
Hand packets to a worker queue
Guidance¶
Usage tip
Queue the packet and return immediately when processing involves disk, plotting, networking, or heavy numerical work.
Common error
Blocking the callback also blocks the reader thread and can make telemetry appear frozen.