Source code for suboptimumg.models

from pydantic import BaseModel, ConfigDict, Field


[docs] class SimulationState(BaseModel): """ Pydantic model representing the vehicle state used in our simulation. """ model_config = ConfigDict(frozen=True, extra="forbid") sliding: bool = Field(description="Whether the vehicle is sliding") acc: float = Field(description="Longitudinal acceleration (m/s^2)") v: float = Field(description="Current velocity (m/s)") dt: float = Field(description="Current time step (s)") p: float = Field(description="Current power (W)") motor_torque: float = Field( default=0.0, description=( "Per-motor shaft torque (N*m), signed: positive driving, negative " "regen. This is the mechanical output torque of a SINGLE motor " "(total drivetrain torque / motor count), the quantity the " "efficiency LUT and the real motor torqueFeedback are indexed by." ), ) roll: float = Field(default=0.0, description="Roll angle (rad)") pitch: float = Field(default=0.0, description="Pitch angle (rad)")
[docs] def model_copy(self, *args, **kwargs): """ Model copy is disabled to ensure immutability. """ raise TypeError("Copying is disabled for SimulationState")
[docs] def copy(self, *args, **kwargs): """ Copy is disabled to ensure immutability. """ raise TypeError("Copying is disabled for SimulationState")