Files
JackBot/inputs/InputProvider.py
JackM323 b537677277 Complete Restructered Robot Code
Robot into its own Class instead of lose Global Variables that cause circular imports

StateClass usage instead of the old RobotState.py

New Input Class for Controller and randome intputs
2026-07-30 21:14:50 +02:00

27 lines
784 B
Python

"""
inputs/InputProvider.py - Abstraction layer for robot control inputs
"""
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import List
@dataclass
class CommandFrame:
"""Represents a snapshot of control inputs at a single tick."""
state: str = "idle"
vector_dirmov: List[float] = field(default_factory=lambda: [0.0, 0.0, 0.0]) # [vx, vy, omega]
emote: str = ""
class InputProvider(ABC):
"""Abstract Base Class for input providers (Joystick, Random/RL, Scripted, etc.)."""
@abstractmethod
def get_command(self) -> CommandFrame:
"""Polls or generates the latest input command frame."""
pass
def stop(self) -> None:
"""Optional cleanup when shutting down input loop."""
pass