Files
gps-denied-onboard/models/core/gps_point.py
T
Oleksandr Bezdieniezhnykh abc26d5c20 initial structure implemented
docs -> _docs
2025-12-01 14:20:56 +02:00

22 lines
529 B
Python

from pydantic import BaseModel, field_validator
class GPSPoint(BaseModel):
lat: float
lon: float
@field_validator("lat")
@classmethod
def validate_lat(cls, v: float) -> float:
if not -90 <= v <= 90:
raise ValueError("Latitude must be between -90 and 90")
return v
@field_validator("lon")
@classmethod
def validate_lon(cls, v: float) -> float:
if not -180 <= v <= 180:
raise ValueError("Longitude must be between -180 and 180")
return v