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)")
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")