fix: report negotiated color resolution in /status
Read width/height/fps from the live pipeline profile instead of hardcoding 640x480, so /status reflects the firmware-accepted resolution (e.g. the USB 2.x 640x480@15 fallback) rather than the requested config. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
08977ac6f6
commit
f1f1277755
2 files changed
+16
-1
No files matched your search
@@ -126,7 +126,7 @@ async def status():
|
|||||||
"color_available": _camera.is_color_available() if (_camera and _camera.is_open()) else False,
|
"color_available": _camera.is_color_available() if (_camera and _camera.is_open()) else False,
|
||||||
"usb_type": _camera.usb_type() if (_camera and _camera.is_open()) else None,
|
"usb_type": _camera.usb_type() if (_camera and _camera.is_open()) else None,
|
||||||
"frame_count": _frame_count,
|
"frame_count": _frame_count,
|
||||||
"resolution": {"width": 640, "height": 480},
|
"resolution": _camera.resolution() if (_camera and _camera.is_open()) else None,
|
||||||
"intrinsics": _calibration_payload(),
|
"intrinsics": _calibration_payload(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,21 @@ class RealSenseD435:
|
|||||||
def usb_type(self) -> str:
|
def usb_type(self) -> str:
|
||||||
return self._usb_type
|
return self._usb_type
|
||||||
|
|
||||||
|
def resolution(self) -> Optional[dict]:
|
||||||
|
"""Negotiated color stream resolution, or None if not open.
|
||||||
|
|
||||||
|
Reads from the live pipeline profile so the value reflects what the
|
||||||
|
firmware actually accepted — on USB 2.x this is the forced 640x480@15
|
||||||
|
fallback, not the configured `_width/_height`.
|
||||||
|
"""
|
||||||
|
if not self._open or self._profile is None:
|
||||||
|
return None
|
||||||
|
try:
|
||||||
|
stream = self._profile.get_stream(rs.stream.color).as_video_stream_profile()
|
||||||
|
return {"width": stream.width(), "height": stream.height(), "fps": stream.fps()}
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
def init(self) -> bool:
|
def init(self) -> bool:
|
||||||
try:
|
try:
|
||||||
self._ctx = rs.context()
|
self._ctx = rs.context()
|
||||||
|
|||||||
Reference in new issue
Block a user