From d0a4085b591ee595787ffe95c02987bf5f02151d Mon Sep 17 00:00:00 2001 From: Mathieu De Coster Date: Thu, 25 Jan 2024 10:35:50 +0100 Subject: [PATCH] Realsense connection fix (#115) * Fix realsense connection issues * Update changelog * Add URL to realsense fix --- CHANGELOG.md | 1 + .../airo_camera_toolkit/cameras/realsense/realsense.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dcd498..462a25a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ This project uses a [CalVer](https://calver.org/) versioning scheme with monthly ### Fixed - Fixed bug in `get_colored_point_cloud()` that removed some points see issue #25. +- Fixed bug requiring unplug-and-plug of USB cable for Realsense: see issue #109. - Removed camera imports in `airo_camera_toolkit.cameras`: see issue #110. - Added `__init__.py` to `realsense` and `utils` in `airo_camera_toolkit.cameras`, fixing installs with pip and issue #113. diff --git a/airo-camera-toolkit/airo_camera_toolkit/cameras/realsense/realsense.py b/airo-camera-toolkit/airo_camera_toolkit/cameras/realsense/realsense.py index 3828fde..53f0caf 100644 --- a/airo-camera-toolkit/airo_camera_toolkit/cameras/realsense/realsense.py +++ b/airo-camera-toolkit/airo_camera_toolkit/cameras/realsense/realsense.py @@ -59,6 +59,12 @@ def __init__( depth_resolution = Realsense.RESOLUTION_720 if fps <= 30 else Realsense.RESOLUTION_480 config.enable_stream(rs.stream.depth, depth_resolution[0], depth_resolution[1], rs.format.z16, fps) + # Avoid having to reconnect the USB cable, see https://github.com/IntelRealSense/librealsense/issues/6628#issuecomment-646558144 + ctx = rs.context() + devices = ctx.query_devices() + for dev in devices: + dev.hardware_reset() + self.pipeline = rs.pipeline() self.pipeline.start(config)