-
Notifications
You must be signed in to change notification settings - Fork 128
Keyboard support for robot diagnostics mode in Thunderscope #3738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 13 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
8667bd6
keyboard support
GrayHoang 538aadc
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 444654d
refactor
GrayHoang 037a706
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] eadc24d
pygame
GrayHoang 67a2989
Merge branch 'wasdqe-control' of https://github.com/GrayHoang/Softwar…
GrayHoang 733c456
requirementslock
GrayHoang 2709017
Merge branch 'master' of https://github.com/UBC-Thunderbots/Software …
GrayHoang 4d750e7
[pre-commit.ci lite] apply automatic fixes
pre-commit-ci-lite[bot] 8421b5b
Remove outdated pyserial reference
nycrat 1f8e8e8
Revert "Remove outdated pyserial reference"
nycrat 38b8e91
Add back pyserial requirement for estop helper
nycrat d4d1c83
Regenerate requirements lock
nycrat 65a2648
Merge branch 'master' into wasdqe-control
nycrat d59caa4
Rename to IControllerBase
nycrat 954c7f3
Make code consistent with docs
nycrat 67b9937
Get rid of unnecessary placeholders
nycrat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/software/thunderscope/robot_diagnostics/controller_base.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| from abc import ABC, abstractmethod | ||
|
|
||
|
|
||
| class ControllerBase(ABC): | ||
| """Abstract base class for controller input sources.""" | ||
|
|
||
| @abstractmethod | ||
| def name(self) -> str: | ||
| """Get the display name of the input source.""" | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def connected(self) -> bool: | ||
| """Return true if the input source is active and available.""" | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def close(self) -> None: | ||
| """Release any resources held by the input source.""" | ||
| ... | ||
|
|
||
| def update(self) -> None: | ||
| """Refresh controller input state. Called once per frame before reading inputs. | ||
| Override for polled backends; push-based controllers can leave this as a no-op. | ||
| """ | ||
| pass | ||
|
|
||
| @abstractmethod | ||
| def get_move_velocity(self) -> tuple[float, float, float]: | ||
| """Return (x, y, angular) velocity, each normalized to [-1, 1] with deadzone applied. | ||
| Positive x = forward, positive y = strafe left, positive angular = CCW. | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def get_speed_factor(self) -> float: | ||
| """Return 1.0 normally, or SPEED_SLOWDOWN_FACTOR when slowdown input is active.""" | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def is_dribbler_held(self) -> bool: | ||
| """Return True if the dribbler engage input is active.""" | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def get_kick_power_step(self) -> int: | ||
| """Return -1, 0, or +1 for kick/chip power step direction. | ||
| Non-zero only once per new input (edge-detected). | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def get_dribbler_step(self) -> int: | ||
| """Return -1, 0, or +1 for dribbler RPM step direction. | ||
| Non-zero only once per new input (edge-detected). | ||
| """ | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def is_kick_fired(self) -> bool: | ||
| """Return True once per kick button press (rising edge only).""" | ||
| ... | ||
|
|
||
| @abstractmethod | ||
| def is_chip_fired(self) -> bool: | ||
| """Return True once per chip button press (rising edge only).""" | ||
| ... | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.