9c31de3c38
config into dataclass and enums new Gui that includes settings deleted GlobalVariables small fixes (import, names...)
47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
"""
|
|
config.py - Central Configuration & Parameters for JackBot
|
|
"""
|
|
from dataclasses import dataclass, field
|
|
from enum import Enum
|
|
|
|
|
|
class BackendType(Enum):
|
|
SIMULATION = "sim"
|
|
ESP32 = "esp32"
|
|
ARDUINO = "arduino"
|
|
|
|
|
|
@dataclass
|
|
class RobotConfig:
|
|
# -------------------------------------------------------------------------
|
|
# 1. Execution & Backend Target
|
|
# -------------------------------------------------------------------------
|
|
backend: BackendType = BackendType.SIMULATION
|
|
urdf_path: str = "JackBotUrdf.urdf"
|
|
|
|
# Hardware Connection Settings
|
|
port: str = "COM4" # Serial Port for Arduino
|
|
baudrate: int = 38400 # Baudrate for Serial
|
|
esp32_ip: str = "192.168.188.32" # Wi-Fi IP for ESP32 UDP communication
|
|
esp32_port: int = 3323 # UDP Target Port
|
|
comm_timeout: float = 2.0 # Connection timeout threshold [s]
|
|
|
|
# -------------------------------------------------------------------------
|
|
# 2. Gait & Motion Kinematics Parameters
|
|
# -------------------------------------------------------------------------
|
|
step_height: float = 0.05 # Clearance height of foot swing [m]
|
|
step_length: float = 0.08 # Maximum stride distance [m]
|
|
translation_gain: float = 1.0 # Speed multiplier for directional translation
|
|
rotation_gain: float = 4.0 # Speed multiplier for yaw rotation
|
|
|
|
# Timing & Execution Frequency
|
|
tick_rate_hz: float = 25.0 # Motion loop execution rate [ticks/sec]
|
|
step_duration: float = 0.8 # Time to complete full gait stride [s]
|
|
|
|
@property
|
|
def tick_duration(self) -> float:
|
|
return 1.0 / self.tick_rate_hz
|
|
|
|
|
|
# Global Active Instance
|
|
cfg = RobotConfig() |