From 4971f5e7efa877556baeae7dbca539e098916335 Mon Sep 17 00:00:00 2001 From: WillB97 Date: Fri, 5 Sep 2025 20:16:27 +0100 Subject: [PATCH] Also close camera socket --- sr/robot3/simulator/camera.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sr/robot3/simulator/camera.py b/sr/robot3/simulator/camera.py index e5bd134e..a41e5d8b 100644 --- a/sr/robot3/simulator/camera.py +++ b/sr/robot3/simulator/camera.py @@ -1,3 +1,4 @@ +import atexit import struct import cv2 @@ -39,6 +40,8 @@ def __init__(self, camera_info: BoardInfo) -> None: self.image_size = tuple(map(int, response.split(b":"))) assert len(self.image_size) == 2, f"Invalid image dimensions: {self.image_size}" + atexit.register(self.close) + def read(self, fresh: bool = True) -> NDArray: """ The method for getting a new frame.