Common: added aerotech coordinate model for using smargon to interface aerotech

This commit is contained in:
appleb_m committed 2026-02-06 15:58:00 +01:00
1 parent 1fd9988a2f
commit e1866c0085
1 file changed
+18
+18
View File
@@ -102,3 +102,21 @@ def positive_coords(value: Coordinate) -> Coordinate:
if value.x <= 0 or value.y <= 0:
raise ValueError("Coordinates must be positive")
return value
class AerotechCoordinate(BaseModel):
at_mm: Optional[Coordinate] = None
omega_deg: Optional[float] = None
def eq(self, other: "AerotechCoordinate", tol: float) -> bool:
return (
abs(self.at_mm.x - other.at_mm.x) < tol
and abs(self.at_mm.y - other.at_mm.y) < tol
and abs(self.at_mm.z - other.at_mm.z) < tol
and abs(self.omega_deg - other.omega_deg) < tol
)
def __eq__(self, other: object) -> bool:
if isinstance(other, AerotechCoordinate):
return self.eq(other, tol=0.01)
return NotImplemented