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

SmartDashboard Chooser Bridge

Expose a thin controller that interacts with a SmartDashboard chooser, allowing dashboard code to observe available options, read the current selection (falling back to a default), push a new selection, and stop listening cleanly.

Capabilities

Reads chooser state

  • With no chooser entries present, get_choices returns an empty sequence and get_selection returns None. @test
  • When only a default option is present and no explicit selection exists, get_selection returns that default value. @test

Responds to remote updates

  • When the dashboard updates the options entry for the chooser key, the provided on_choices callback is invoked with the new options in order. @test
  • When the dashboard updates the active selection entry, the provided on_selection callback is invoked with the new selection value. @test

Applies selection changes

  • Calling set_selection publishes the new selection to the chooser entries so subsequent reads return that value. @test

Lifecycle management

  • After close is called, further dashboard updates do not trigger callbacks, but the last known selection can still be read. @test

Implementation

@generates

API

from typing import Callable, Optional, Sequence

class SmartDashboardChooserBridge:
    def __init__(
        self,
        key: str,
        on_choices: Optional[Callable[[Sequence[str]], None]] = None,
        on_selection: Optional[Callable[[Optional[str]], None]] = None,
    ) -> None: ...

    def get_choices(self) -> Sequence[str]: ...

    def get_selection(self) -> Optional[str]: ...

    def set_selection(self, selection: str) -> None: ...

    def close(self) -> None: ...

Dependencies { .dependencies }

pynetworktables { .dependency }

Use this dependency to connect to the SmartDashboard chooser entries and rely on its chooser integration utilities.

Version

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