Added Gui (unfinished)

config into dataclass and enums
new Gui that includes settings
deleted GlobalVariables

small fixes (import, names...)
This commit is contained in:
2026-07-30 22:49:53 +02:00
parent b537677277
commit 9c31de3c38
13 changed files with 383 additions and 230 deletions
+41 -25
View File
@@ -1,31 +1,47 @@
# Connection
port = "COM4"
baudrate = 38400
"""
config.py - Central Configuration & Parameters for JackBot
"""
from dataclasses import dataclass, field
from enum import Enum
esp32_ip = "192.168.188.32"
esp32_port = 3323
timeout = 2.0
class BackendType(Enum):
SIMULATION = "sim"
ESP32 = "esp32"
ARDUINO = "arduino"
sim: bool = True
arduinoConnection: bool = False
urdf_path = "JackBotUrdf.urdf"
# row = legnumber (left 0,1,2 right 3,4,5)
# column = servo position from torso(0) to feet(2)
@dataclass
class RobotConfig:
# -------------------------------------------------------------------------
# 1. Execution & Backend Target
# -------------------------------------------------------------------------
backend: BackendType = BackendType.SIMULATION
urdf_path: str = "JackBotUrdf.urdf"
# Dimensions in m
#robot_height = -0.1
step_height = 0.03
step_length = 0.04
translation_gain = 1.0
rotation_gain = 2.0
# Leglength in m
# L1 = 0.068
# L2 = 0.0602
# L3 = 0.070
# 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]
# standard_tickpersec = # 20 Fluessige Bewegung
standard_tickpersec:float = 25 # [ticks/s]
standard_duration:float = 0.8 # [s]
standard_tickduration:float = 1 / standard_tickpersec
# -------------------------------------------------------------------------
# 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()