forked from UBC-Thunderbots/Software
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller_base.py
More file actions
30 lines (23 loc) · 815 Bytes
/
Copy pathcontroller_base.py
File metadata and controls
30 lines (23 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 key_down(self, key_code: int) -> bool:
"""Return true if the given key/button code is currently pressed."""
...
@abstractmethod
def abs_value(self, abs_code: int) -> float:
"""Return the current value of an axis, normalized to [-1, 1]."""
...
@abstractmethod
def close(self) -> None:
"""Release any resources held by the input source."""
...