Skip to content

fix(realsense): ignore invalid frames for disabled streams - #2

Open
bowenszhu wants to merge 1 commit into
Seeed-Projects:DepthCameraSupportfrom
bowenszhu:fix-realsense-invalid-frame-check
Open

fix(realsense): ignore invalid frames for disabled streams#2
bowenszhu wants to merge 1 commit into
Seeed-Projects:DepthCameraSupportfrom
bowenszhu:fix-realsense-invalid-frame-check

Conversation

@bowenszhu

Copy link
Copy Markdown

Type / Scope

  • Type: Bug
  • Scope: RealSense cameras

Summary / Motivation

pyrealsense2 can return a non-None frame object whose boolean value is false when a stream is disabled. SharedRealSenseManager._build_frame_snapshot() previously treated such handles as valid and could call get_data(), raising null pointer passed for argument "frame_ref". This change uses the SDK frame's truthiness so invalid color and depth handles are ignored while valid frames keep the existing decode and copy behavior.

Related issues

  • Fixes / Closes: N/A
  • Related: N/A

What changed

  • Check color and depth frames with truthiness before decoding or reading data.
  • Add isolated regression tests for falsey color and depth frame handles.
  • Verify valid frame behavior still decodes RGB and copies depth data.
  • No breaking changes.

How was this tested (or how to run locally)

  • Added tests/cameras/test_realsense_frame_snapshot.py.

  • Ran the focused regression tests and dependency check:

    python -m unittest discover -s tests/cameras -p 'test_realsense_frame_snapshot.py' -v
    python -m pip check

    Result: all 3 tests passed, and pip check reported no broken requirements.

  • Ran the read-only hardware regression check:

    lerobot-find-cameras realsense \
      --output-dir /tmp/lerobot-camera-regression-check \
      --record-time-s 3

    Detected D435i 261822072940 and D405 260522274196, saved an RGB image from each camera, and observed no frame_ref errors or frame timeouts.

  • The existing lerobot Conda environment did not include pytest or Ruff, so those runners could not be executed. No dependencies were installed or upgraded.

Checklist (required before merge)

  • Linting/formatting run (pre-commit run -a)
  • All tests pass locally (pytest)
  • Documentation updated
  • CI is green

Reviewer notes

  • Please focus on the falsey-but-non-None frame semantics returned by pyrealsense2 for disabled streams.
  • The new regression tests use mock frames and do not require a physical RealSense camera.
  • Anyone in the community is free to review the PR.

Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant