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 get depth information and IMU data at the same time on windows ? #2945

Closed
MaoPann opened this issue Dec 21, 2018 · 6 comments
Closed
Assignees
Labels

Comments

@MaoPann
Copy link

MaoPann commented Dec 21, 2018

  • 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 (Open RealSense Viewer --> Click info)
Operating System & Version {Win (8.1/10)
Kernel Version (Linux Only)
Platform PC.
SDK Version sdk 2.6.5
Language {C }
Segment {Robot}

Issue Description

<>

@dorodnic
Copy link
Contributor

dorodnic commented Dec 21, 2018

If you are looking to get IMU and depth data at the same rate, look at rs-capture. When you run it with the D435i, two frames in the frameset will be of type motion_frame.
If you are looking to get the IMU as fast as possible, without video data processing delaying it, please look at rs-callback

Please note that you need the latest SDK version (2.17+), I would recommend building from source the development branch, since several fixes for the IMU on Windows has been merged but not released yet.

@dorodnic dorodnic added the d435i label Dec 21, 2018
@MaoPann
Copy link
Author

MaoPann commented Dec 22, 2018

In the enable_stream function, how should I configure it?

@MaoPann
Copy link
Author

MaoPann commented Dec 22, 2018

Can you share a call code?

@MaoPann
Copy link
Author

MaoPann commented Dec 22, 2018

Thank you very much for your guidance.

@dorodnic
Copy link
Contributor

Happy to help.

To enable IMU explicitly, you can call config.enable_stream(RS2_STREAM_ACCEL); and config.enable_stream(RS2_STREAM_GYRO);.

You could also specify the frame-rate using config.enable_stream(RS2_STREAM_ACCEL, RS2_FORMAT_MOTION_XYZ32F, 250) (this will set the accelerometer rate at 250 Hz)

You can see the list of supported configurations here and in the device data-sheet.

We don't include explicit configuration details in the examples, because we want the same examples to work on all supported (and future) devices. So if you don't provide an explicit configuration, you will just get the default IMU from the D435i.

Once you do get a frameset with motion frames, you can cast them to rs2::motion_frame:

using namespace std;
using namespace rs2;
frameset fs = p.wait_for_frames();
for (auto& f : fs) {
   if (f.is<motion_frame>()) {
       motion_frame mf = f.as<motion_frame>();
       rs2_vector xyz = mf.get_motion_data();
       cout << f.get_profile().stream_type() << ": " 
            << xyz.x << ", " << xyz.y << ", " << xyz.z << endl;
   }
}

@RealSense-Customer-Engineering
Copy link
Collaborator

[Realsense Customer Engineering Team Comment]
Closing this issue. Please reopen if need further assistance. Thank you.

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

3 participants