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%
Create a small utility that monitors live table data and turns network updates into structured events for downstream consumers.
connected=True is delivered, a connection event is recorded with the provided info payload. @testconnected=False is recorded. @testSmartDashboard table, creating the key speed with value 3.5 emits a single entry event containing the full path /SmartDashboard/speed, the numeric value, and is_new=True. @testis_new=False while reflecting the latest value. @testVision is created under a watched root, a subtable event records parent="SmartDashboard" and name="Vision" once; subsequent entry additions inside that subtable do not duplicate the discovery event. @teststop() is called, further entry or connection changes no longer append to the event log. @test@generates
from typing import Callable, List, Dict, Any
class ListenerMonitor:
def __init__(self, server: str = "localhost"):
...
def start(
self,
watch_tables: List[str],
on_entry: Callable[[str, Any, bool], None],
on_subtable: Callable[[str, str], None],
on_connection: Callable[[bool, Dict[str, Any]], None],
) -> None:
"""
Connects to the table server and registers listeners for the given root tables.
on_entry receives (full_path, value, is_new).
on_subtable receives (parent_table, subtable_name).
on_connection receives (connected, info).
Every listener invocation is also appended to the internal event log.
"""
def stop(self) -> None:
"""Unregisters all listeners and disconnects/cleans up resources."""
def get_events(self) -> List[Dict[str, Any]]:
"""
Returns a chronological list of captured events describing entries, subtables, and connections.
Each event dict includes a 'type' field (entry|subtable|connection) and type-specific payload:
- entry events include keys 'path', 'value', and 'is_new'
- subtable events include keys 'parent' and 'name'
- connection events include keys 'connected' and 'info'
"""Provides realtime table, entry, subtable, and connection listener APIs.