Skip to content

autodiscover opmodes + opmode example#260

Open
virtuald wants to merge 8 commits into
mainfrom
opmode-discovery
Open

autodiscover opmodes + opmode example#260
virtuald wants to merge 8 commits into
mainfrom
opmode-discovery

Conversation

@virtuald
Copy link
Copy Markdown
Member

@virtuald virtuald commented May 6, 2026

This is purely vibe-coded, but this is at least an initial look at what this will look like

@virtuald virtuald force-pushed the opmode-discovery branch from 067f248 to cbde6e1 Compare May 6, 2026 06:15
@virtuald virtuald force-pushed the opmode-discovery branch from 98427ce to cf18107 Compare May 8, 2026 12:52
Comment thread examples/robot/ExpansionHubSample/defaulttelemode.py


@overload
def autonomous(cls: _OpModeType, /) -> _OpModeType: ...
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need docstrings for these decorators, should also document them in OpModeRobot

return False


def _iter_scan_files(root: Path):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesnt really need to be a separate function -- but also, should we only scan the current directory, or maybe a specified directory?

If the user creates a .venv next to robot.py, then it will scan that entire thing and load any opmodes found. That seems bad.


def __init__(self):
super().__init__()
_discover_decorated_opmodes(self)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the associated code with this seems a bit messy, need to reorg it a bit

@virtuald virtuald marked this pull request as ready for review May 18, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant