sim2bot.Robot.state¶
state(robot: int = 0) -> Optional[RobotState]
¶
Return the newest complete telemetry packet for one robot.
Parameters:
-
robot(int, default:0) –Robot index returned by
describe.
Returns:
-
Optional[RobotState]–Latest
RobotState, orNonebefore -
Optional[RobotState]–the first packet arrives.
Notes
State is latest-value rather than queued. A slow consumer does not fall behind by reading old packets.
Source code in sim2bot/client.py
Practical examples¶
Examples use objects discovered from the current scene rather than hard-coded robot metadata.
Read joint and TCP state
Wait for the first packet
Guidance¶
Usage tip
Check for None during startup. Once telemetry begins, each call returns the newest complete packet.
Common error
A tight loop reading state() does not create new samples; packet production is controlled by the browser telemetry rate.