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-10/

Table Telemetry Store

Organizes robot telemetry into nested tables and performs typed writes/reads for primitives, arrays, and raw bytes. All data lives under a drive, pose, and status branch rooted at the provided table, plus a frames sub-branch indexed by frame number.

Capabilities

Builds nested branches

  • Instantiating the store against an empty root populates nested branches drive, pose, and status, and ensures repeated calls reuse the same branches without duplicating keys. @test
  • Listing keys at the root after initialization returns only those three branch names and no leaf entries. @test

Writes and reads primitives

  • Calling update_drive(1.25, -0.5) writes numeric leaf entries under the drive branch, and calling it again with new numbers overwrites the leaf values in place. @test
  • record_pose(2.0, 3.5, 90.0) writes numeric leaf entries under the pose branch, and snapshot() returns a dict containing the latest drive and pose numbers. @test
  • set_default_mode("disabled") sets a string leaf under status only when missing, returning the persisted value even if later calls pass a different default. @test

Handles array entries

  • publish_status([True, False], ["init", "auto"]) stores and returns sequences under the status branch, preserving order and type on read-back via snapshot(). @test

Stores raw frames

  • save_frame(b"\\x01\\x02\\x03") writes raw bytes under an incrementing frames/<index> key and returns the index; snapshot() includes the raw payload at that index and leaves earlier frames untouched. @test

Implementation

@generates

API

from typing import Any, Sequence

class TelemetryStore:
    def __init__(self, root_table: Any) -> None: ...
    def update_drive(self, left_speed: float, right_speed: float) -> dict[str, float]: ...
    def record_pose(self, x: float, y: float, heading_deg: float) -> dict[str, float]: ...
    def set_default_mode(self, default_mode: str) -> str: ...
    def publish_status(self, faults: Sequence[bool], tags: Sequence[str]) -> dict[str, Sequence]: ...
    def save_frame(self, frame_bytes: bytes) -> int: ...
    def snapshot(self) -> dict[str, Any]: ...

Dependencies { .dependencies }

pynetworktables { .dependency }

Python client for hierarchical NetworkTables communication.

@satisfied-by

Version

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