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

Timeouts #6

Closed
lukier opened this issue Jan 24, 2016 · 6 comments
Closed

Timeouts #6

lukier opened this issue Jan 24, 2016 · 6 comments
Labels

Comments

@lukier
Copy link

lukier commented Jan 24, 2016

Not strictly an issue, more of a question.

Do you consider adding timeouts for the rs_wait_for_frames call? I see it has some std::chrono fixed 5 second timeout, but this is just busy looping in infinite while loops, not a blocking call.

It is not passed to struct timeval for the select in v4l2 backend or libusb transfer setups - libuvc also hardcodes 5 second timeout.

This is perhaps not that critical as proper blocking is not that useful for cameras that don't have external triggers (like dc1394 or PointGrey), but I think it would be useful to have user settable timeout anyway (5 s might be too long).

In the meantime I'll read the code some more and think how to approach this issue.

@sgorsten
Copy link
Contributor

This is a somewhat tricky issue. The behavior of rs_wait_for_frames(...) is to block until a coherent frameset is available. However, there are also a class of hardware errors which prevent further streaming and which are only portably detectable by the fact that new frames stop arriving over the UVC connection, so rs_wait_for_frames(...) is also responsible for detecting this scenario and raising an error in that case.

The timing and synchronization code is due for a bit of an overhaul, though, and if there's interest, we could add a second method (rs_check_for_frames(...), perhaps?) with a user specifiable timeout and a return value to indicate if new data is available.

As an aside, if you have a use case that seems to be frequently triggering the timeout, please open it as a second issue, and we'll see if we can do something to improve the reliability of streaming for that use case.

@lukier
Copy link
Author

lukier commented Jan 24, 2016

I thought it might be tricky with multiple streams from multiple devices (/dev/videoX) etc.

I was mostly worried about while(true) loops in wait_all_streams consuming CPU core looping, either until next frame (15-30 ms) or in error condition until 5 second timeout, but it seems not that bad - I suppose thanks to the atomics in triple_buffer.

BTW are the sensors (RGB/Depth) in F200/R200 hardware synchronized? Either by sharing pixel clock or exposure timestamped to a common HW timer? I see something related in stream_buffer::frame::timestamp so I was hopeful that the cameras have proper timing, not like Kinect with two separate free running sensors.

@ddiakopoulos
Copy link
Contributor

Both F200 and R200 have internal sync mechanism to trigger the sensors on a common clock. These are exposed to software via frame-counters, and we provide matched frame sets in librealsense. The SR300 has a revised timing architecture (via frame metadata in the UVC protocol) that provides additional timing information, and we'll expose that as a feature when SR300 reaches general availability.

@lukier
Copy link
Author

lukier commented Jan 27, 2016

Awesome, that's proper camera engineering right there :) If only these cameras had GPIO trigger in/out to synchronize other things as well (think IMU, robot's odometry etc).

@lukier lukier closed this as completed Jan 27, 2016
@floe
Copy link
Contributor

floe commented Jan 27, 2016

👍 for trigger I/O (or at least for a hint on where to solder :-)

@muzafferkal
Copy link

Trigger IO would be awesome; please?

dorodnic pushed a commit to dorodnic/librealsense that referenced this issue Aug 14, 2018
Merge Development from librealsense to abernste
YoshuaNava pushed a commit to YoshuaNava/librealsense that referenced this issue Dec 10, 2018
nhershko added a commit to nhershko/librealsense that referenced this issue Feb 23, 2020
nohayassin referenced this issue in nohayassin/librealsense May 21, 2020
ev-mp pushed a commit that referenced this issue Oct 5, 2020
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

5 participants