Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion vex/aim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down Expand Up @@ -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]
Expand Down