From f233d394683fb465e49552aeb428b16bf1b06f32 Mon Sep 17 00:00:00 2001 From: Dave Touretzky Date: Sun, 4 Jan 2026 11:41:31 -0500 Subject: [PATCH] fix issue 11: impatient timeout of get_camera_image() --- vex/aim.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vex/aim.py b/vex/aim.py index 1725d7f..cf9bd61 100644 --- a/vex/aim.py +++ b/vex/aim.py @@ -59,6 +59,9 @@ DRIVE_VELOCITY_MAX_MMPS = 200 # millimeters per second TURN_VELOCITY_MAX_DPS = 180 # Degrees per second + +INITIAL_IMAGE_TIMEOUT = 5.0 # seconds + class AimException(Exception): """VEX AIM Exception Class""" @@ -2119,7 +2122,8 @@ def get_camera_image(self): start_time = time.time() time_elapsed = 0 self.robot_instance._ws_img_thread.start_stream() - while (self.robot_instance._ws_img_thread.image_list[self.robot_instance._ws_img_thread.current_image_index] == bytes(1) and time_elapsed < 0.5): + while (self.robot_instance._ws_img_thread.image_list[self.robot_instance._ws_img_thread.current_image_index] == bytes(1) and \ + time_elapsed < INITIAL_IMAGE_TIMEOUT): time.sleep(0.01) time_elapsed = time.time() - start_time image = self.robot_instance._ws_img_thread.image_list[self.robot_instance._ws_img_thread.current_image_index]