tessl install tessl/pypi-pynetworktables@2021.0.0A pure Python implementation of NetworkTables, used for robot communications in the FIRST Robotics Competition.
Agent Success
Agent success rate when using this tile
75%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.01x
Baseline
Agent success rate without this tile
74%
A small module that configures NetworkTables as either a server or a client, applies a network identity, and exposes a minimal snapshot of the connection state.
server, listen address, port, and a persistence file, the module brings up a host and reports server mode while remaining connected to no remotes. @testclient and one or more target addresses, the module dials those endpoints and reports connected status plus the remote address list after a successful handshake. @test@generates
from typing import Literal, TypedDict, Optional, List
class ConnectionConfig(TypedDict, total=False):
role: Literal["server", "client"]
identity: str
addresses: List[str]
team: int
port: int
persist_file: str
listen_address: str
def configure_network(config: ConnectionConfig) -> None:
"""
Apply identity first, then start server or client according to config.
"""
def wait_for_connection(timeout: float = 1.0) -> bool:
"""
Wait up to timeout seconds for a connection when operating as a client.
"""
def connection_state() -> dict:
"""
Return a snapshot containing:
- identity: str
- mode: one of \"server\", \"client\", or \"idle\"
- connected: bool
- remotes: List[str] of remote addresses when connected
"""
def reset_network() -> None:
"""
Stop any running server/client activity and clear connection info while keeping the configured identity.
"""Python NetworkTables implementation for establishing client/server connections and setting network identity.