Skip to content

CvSink randomly times out even when camera is being captured properly #5135

Open
@mjansen4857

Description

@mjansen4857

Describe the bug
When using a CvSink to grab frames from a UsbCamera started with the CameraServer.startAutomaticCapture() method, the CvSink's grabFrame method will randomly time out, even though capture of the camera is definitely running and viewable from Shuffleboard. It is also running at a high enough frame rate that multiple frames should have been supplied to the sink before timing out.

This only seems to happen the first time grabFrame is called after code starts. Future calls after the first one succeeds will work fine.

To Reproduce
Steps to reproduce the behavior:

  1. Start automatic capture of a UsbCamera in robotInit and create a CvSink for it
  2. In teleopInit, grab a frame.
  3. Observe that when enabled, the grabFrame method will sometimes time out and return 0

Expected behavior
grabFrame method should be able to grab a frame before the time out expires if the camera is being streamed properly

Desktop (please complete the following information):

  • WPILib Version: 2023.4.2
  • OS: Windows 11
  • Java version: 17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions