librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Recovering from streaming timeout error (question)

Open digitologist opened this issue 10 years ago • 9 comments

Running my app with 8 R200s, I found that individual cameras would start throwing timeout errors. The error handling allowed me to recognize and skip the future wait-for-frames call for the affected devices, but I wasn't able to find the correct way to recover the error without restarting the application.

This was a live installation so I didn't have the opportunity to stop & restart the app, let alone unplug/replug the device, so my number of active cameras simply dropped over time.

Is there a correct way to allow for a camera that's not returning frames to be closed, unplugged/replugged, and then recover streaming?

digitologist avatar Feb 10 '16 01:02 digitologist

For R200 we have a few unpublished commits that let you reset the device after a frame timeout. Ping @sgorsten to push them in the next few days.

ddiakopoulos avatar Feb 10 '16 03:02 ddiakopoulos

How do you catch the timeout errors? I do use try-catch to wrap the code for wait-for-frames and frame capturing, but it looks like no error is thrown. The programm freezes while waiting for a frame and never gets back.

Wollimayer avatar Feb 10 '16 16:02 Wollimayer

@digitologist do you have a snippit of code to share with @Wollimayer?

ddiakopoulos avatar Feb 10 '16 22:02 ddiakopoulos

Here's how I do it:

for (int i = 0; i < deviceCount; ++i) {
    if (deviceAbort[i]) continue;
    try {
        deviceManager[i]->wait_for_frames();
    }
    catch (const rs::error & e) {
        deviceAbort[i] = true;
        cout << "Realsense Error: cam " << i << ": " << e.what() << endl;
    }
}

digitologist avatar Feb 10 '16 23:02 digitologist

@digitologist Thank you. I'm using the same construct right now, but no error is thrown. It might be a different problem ( issue #29 ).

Wollimayer avatar Feb 11 '16 13:02 Wollimayer

@Wollimayer - can you use one of the other sample apps to print out the firmware versions of each of your F200s?

ddiakopoulos avatar Feb 11 '16 17:02 ddiakopoulos

2.60.0.0 And two 2.50.0.0 . The problem occurs on both versions.

Wollimayer avatar Feb 13 '16 10:02 Wollimayer

@Wollimayer will discuss in #29, streaming timeouts and config timeouts are logically different issues.

For streaming timeouts, code on the the current dev branch should be able to reset a device fully at runtime after code like @digitologist detects a timeout.

ddiakopoulos avatar Feb 13 '16 21:02 ddiakopoulos

Hi, I also have problems with timeout of streaming. I can catch the error, stop and start the camera and then the stream is running. But the timestamps then are wrong. the get_frame_timestamp function gives numbers between -3 and 4. Is that a bug? How can I restart the camera properly?

MFUHH avatar Jun 29 '17 17:06 MFUHH