Tile
High-level asynchronous API for a single OmniTile.
- class omnitiles.tile.Tile(info, *, transport=None)[source]
Bases:
objectAsync interface to a single OmniTile over BLE.
A
Tileowns aTransportand aStreamParser. Every command method returns once the packet has been handed to the transport — the protocol does not ACK, so a successfulawaitmeans “sent”, not “executed”. Subscribe to telemetry to observe effects.Tiles are async context managers:
async with Tile(info) as tile: await tile.m1_extend()
- Parameters:
info (
TileInfo)transport (
Transport|None)
- property name: str
- property address: str
- property connected: bool
- async m1_extend(speed=255)[source]
Drive M1 in the extend direction at the given PWM speed (0-255).
- Parameters:
speed (
int)- Return type:
None
- async m1_set_position(position)[source]
Command a closed-loop M1 target, scaled 0-255 over the stroke.
- Parameters:
position (
int)- Return type:
None
- async m1_set_position_mm(mm)[source]
Convenience: set M1 target in millimeters along the stroke.
- Parameters:
mm (
float)- Return type:
None
- async base_velocity(vx, vy, omega)[source]
Command open-loop mobile-base velocity. Each component is int8.
- Parameters:
vx (
int)vy (
int)omega (
int)
- Return type:
None
- on_telemetry(callback)[source]
Register
callbackto run on every incoming telemetry frame.Returns a zero-argument function that removes the subscription. Callbacks fire on whatever thread/loop the transport delivers notifications on, so they must not block.
- Parameters:
callback (
Callable[[Telemetry],None])- Return type:
Callable[[],None]