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

Streaming IMU and image data #4386

Closed
sshhj89 opened this issue Jul 8, 2019 · 3 comments
Closed

Streaming IMU and image data #4386

sshhj89 opened this issue Jul 8, 2019 · 3 comments

Comments

@sshhj89
Copy link

sshhj89 commented Jul 8, 2019

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


Required Info
Camera Model D435i
Firmware Version
Operating System & Version Win10
Kernel Version (Linux Only)
Platform PC
SDK Version pyrealsense2 2.24.950
Language python
Segment Robot

Issue Description

<Describe your issue / question / feature request / etc..>
I would like to get streaming data including IMU, depth and color.

As far as I know the D435i's sampling rate for each data is different, for example,

Accelerometer has 63/250 hz, gyro has 200/400 hz, and image data has slower than this.

In current code,
image

the streaming looks like simultaneously depending on the image fps.
image

How can I get whole IMU data generated while image frame interval without drop.

Thanks in advance.

@eMrazSVK
Copy link

eMrazSVK commented Jul 9, 2019

Use poll_for_frames() function. It will not block the thread. It is used in this example. The example considers using multiple cameras, but I hope the principle is the same. The elementary difference is:

  • wait_for_frames() waits until frames are available and blocks main loop until frames are received
  • poll_for_frames() tries to get frames, if frames are not available it exits and loop (thread) is not blocked

@ev-mp
Copy link
Collaborator

ev-mp commented Jul 9, 2019

@sshhj89 hello,
You need to consider the following - using synchronous API calls (wait_for_frames, poll_for_frames, try_wait_for_frames streamlines the application logic flow. But the caveat is the processing required in the user's code. So if, in the above segment, the OpenCv part takes about 30msec to process than the theoretically the FPS is bounded to 33Hz. An actually it will be lower depending on the internal syncer logic.
In case you must not want to miss frames than you should probably examine the asynchronous approach by polling the frames into designated thread-safe queues an then processing them asynchronously.

See more details and per-method demo references in this comment

@dorodnic
Copy link
Contributor

Also, please take a look at rs-callback example, specifically designed for higher frequency input

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

No branches or pull requests

4 participants