diff --git a/field_friend/localization/gnss.py b/field_friend/localization/gnss.py index 529d0939..97c95b94 100644 --- a/field_friend/localization/gnss.py +++ b/field_friend/localization/gnss.py @@ -6,7 +6,7 @@ from abc import ABC, abstractmethod from copy import deepcopy from dataclasses import dataclass -from typing import Any, Optional +from typing import Any import numpy as np import rosys @@ -24,7 +24,7 @@ class GNSSRecord: gps_qual: int = 0 altitude: float = 0.0 separation: float = 0.0 - heading: Optional[float] = None + heading: float | None = None speed_kmh: float = 0.0 @@ -49,7 +49,7 @@ def __init__(self, odometer: rosys.driving.Odometer, antenna_offset: float) -> N self.GNSS_CONNECTION_LOST = rosys.event.Event() """the GNSS connection was lost""" - self.current: Optional[GNSSRecord] = None + self.current: GNSSRecord | None = None self.device: str | None = None self.antenna_offset = antenna_offset self._is_paused = False @@ -107,7 +107,7 @@ def is_paused(self) -> bool: return self._is_paused @abstractmethod - async def _create_new_record(self) -> Optional[GNSSRecord]: + async def _create_new_record(self) -> GNSSRecord | None: pass def _on_rtk_fix(self) -> None: @@ -136,7 +136,7 @@ def _on_rtk_fix(self) -> None: if not self._is_paused: self._update_robot_pose() - async def wait_for_robot_pose_update(self, timeout: Optional[float] = None) -> None: + async def wait_for_robot_pose_update(self, timeout: float | None = None) -> None: event = asyncio.Event() def callback(): nonlocal event