Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set the timeout period for acquiring image data #10084

Closed
shiguangzqz opened this issue Dec 21, 2021 · 7 comments
Closed

How to set the timeout period for acquiring image data #10084

shiguangzqz opened this issue Dec 21, 2021 · 7 comments
Labels

Comments

@shiguangzqz
Copy link

shiguangzqz commented Dec 21, 2021

Image_20211216180654

I want to reduce timeout,which api can i use to reduce the frame arrive timeout?

@MartyG-RealSense
Copy link
Collaborator

Hi @shiguangzqz If the program has not been receiving frames for long enough for a Frame didn't arrive within 15000 message to be generated then something has likely gone wrong, such as a freeze-up in the program's operation. In past cases, this message tends to occur when closing the pipeline with an instruction such as pipe.Stop().

A good reference about freeze after pipeline stop is #7252 - in that case, it was suggested in #7252 (comment) that stopping with sensor.Stop() instead of pipe.Stop() may help. Other RealSense users found that simply updating their SDK and firmware driver versions resolved this error.

@shiguangzqz
Copy link
Author

Hi @shiguangzqz If the program has not been receiving frames for long enough for a Frame didn't arrive within 15000 message to be generated then something has likely gone wrong, such as a freeze-up in the program's operation. In past cases, this message tends to occur when closing the pipeline with an instruction such as pipe.Stop().

A good reference about freeze after pipeline stop is #7252 - in that case, it was suggested in #7252 (comment) that stopping with sensor.Stop() instead of pipe.Stop() may help. Other RealSense users found that simply updating their SDK and firmware driver versions resolved this error.

I will encounter this situation when I unplug the camera usb when acquiring image data
My program timeout is 10s, I hope this timeout error can be returned in 5s or 8s

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Dec 21, 2021

This sounds like a similar situation to one that you experienced in #6518 in June 2020 when Frame didn't arrive within 15000 was occurring because the pipeline was apparently not being closed down cleanly. I understand that in #6518 (comment) within that case you tried dealing with the problem by catching an exception.

A faster way to deal with a problem caused by a USB 'detach' event may be to listen for such an event with a function called set_devices_changed_callback

C++
#931

Python
#4212

@shiguangzqz
Copy link
Author

This sounds like a similar situation to one that you experienced in #6518 in June 2020 when Frame didn't arrive within 15000 was occurring because the pipeline was apparently not being closed down cleanly. I understand that in #6518 (comment) within that case you tried dealing with the problem by catching an exception.

A faster way to deal with a problem caused by a USB 'detach' event may be to listen for such an event with a function called set_devices_changed_callback

C++ #931

Python #4212

I have see the question#931,but I still unknow how to use rs2::contenxt::set_devices_changed_callback,can you show me how to use this?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Dec 21, 2021

A C++ example of using set_devices_changed_callback is provided below.

ctx.set_devices_changed_callback([&](rs2::event_information& info)
{
if (info.was_removed(my_device))
handle_device_removale();
});

A full C++ script that demonstrates ctx.set_devices_changed_callback can be found at #9287 (comment)

image

A Python example of its use provided by a RealSense team member is at #4212 (comment)

image

@MartyG-RealSense
Copy link
Collaborator

Hi @shiguangzqz Do you require further assistance with this case, please? Thanks!

@MartyG-RealSense
Copy link
Collaborator

Case closed due to no further comments received.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants