@@ -113,7 +113,8 @@ async def get_position(self, manipulator_id: str) -> Vector4:
113113 manipulator_data : dict [str , float ] = await self ._manipulator_data (manipulator_id )
114114 stage_z : float = manipulator_data ["Stage_Z" ]
115115
116- await sleep (self .POLL_INTERVAL ) # Wait for the stage to stabilize.
116+ # Wait for the stage to stabilize.
117+ await sleep (self .POLL_INTERVAL )
117118
118119 return Vector4 (
119120 x = manipulator_data ["Stage_X" ],
@@ -139,8 +140,9 @@ async def get_angles(self, manipulator_id: str) -> Vector3:
139140 async def get_shank_count (self , manipulator_id : str ) -> int :
140141 return int ((await self ._manipulator_data (manipulator_id ))["ShankCount" ]) # pyright: ignore [reportAny]
141142
143+ @staticmethod
142144 @override
143- def get_movement_tolerance (self ) -> float :
145+ def get_movement_tolerance () -> float :
144146 return 0.01
145147
146148 @override
@@ -219,7 +221,11 @@ async def set_depth(self, manipulator_id: str, depth: float, speed: float) -> fl
219221 )
220222
221223 # Wait for the manipulator to reach the target depth or be stopped or get stuck.
222- while not self ._movement_stopped and not abs (current_depth - depth ) <= self .get_movement_tolerance ():
224+ while (
225+ not self ._movement_stopped
226+ and not abs (current_depth - depth ) <= self .get_movement_tolerance ()
227+ and unchanged_counter < self .UNCHANGED_COUNTER_LIMIT
228+ ):
223229 # Wait for a short time before checking again.
224230 await sleep (self .POLL_INTERVAL )
225231
@@ -281,6 +287,7 @@ def unified_space_to_platform_space(self, unified_space: Vector4) -> Vector4:
281287 )
282288
283289 # Helper functions.
290+
284291 async def _query_data (self ) -> dict [str , Any ]: # pyright: ignore [reportExplicitAny]
285292 try :
286293 # Update cache if it's expired.
0 commit comments