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
This commit is contained in:
2026-07-30 21:14:50 +02:00
parent 5448335b11
commit b537677277
19 changed files with 955 additions and 916 deletions
+27
View File
@@ -0,0 +1,27 @@
"""
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