CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-pynetworktables

tessl install tessl/pypi-pynetworktables@2021.0.0

A 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%

task.mdevals/scenario-7/

NetworkTables Connection Bootstrapper

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.

Capabilities

Identity-first configuration

  • When given an identity only, the module records it and reports an idle state without opening sockets. @test

Start as server with persistence

  • With role server, listen address, port, and a persistence file, the module brings up a host and reports server mode while remaining connected to no remotes. @test

Connect as client to specific targets

  • With role client 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

Reset and reuse configuration

  • After operating as a client, calling reset stops network activity and leaves the stored identity intact while clearing connection details. @test

Implementation

@generates

API

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.
    """

Dependencies { .dependencies }

pynetworktables { .dependency }

Python NetworkTables implementation for establishing client/server connections and setting network identity.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/pynetworktables@2021.0.x
tile.json