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

Is there are sample python code for D435i getting IMU information? #3917

Closed
spk921 opened this issue May 6, 2019 · 3 comments
Closed

Is there are sample python code for D435i getting IMU information? #3917

spk921 opened this issue May 6, 2019 · 3 comments

Comments

@spk921
Copy link

spk921 commented May 6, 2019

Is there are sample python code for D435i getting IMU information?

@beduffy
Copy link

beduffy commented Jul 9, 2019

I'm also interested in this for the python wrapper:

config.enable_stream(rs.stream.pose) # crashes here RuntimeError: Couldn't resolve requests

if I try to have an empty config I get
pose = frames.get_pose_frame()
pose is a null pointer so later on pose_frame = np.asanyarray(pose_frame.get_data()) crashes

Similar with accel and gyro.
AttributeError: 'pyrealsense2.pyrealsense2.composite_frame' object has no attribute 'get_accel_frame'

Is C++ the only option for this?

Using realsense 2.23 at the moment since 2.24 has another problem.

@beduffy
Copy link

beduffy commented Jul 12, 2019

#2718
#3070
#3101
#3053
https://github.com/GruffyPuffy/imutest
https://software.intel.com/sites/products/realsense/slam/developer_guide.html
https://www.intelrealsense.com/how-to-getting-imu-data-from-d435i-and-t265/

Haven't solved this yet, but I think I will solve it from reading the above. Should be useful for others trying to find out as well. Will update once I work it out.

@beduffy
Copy link

beduffy commented Jul 17, 2019

Got the answer from #3409
The API is a bit strange on this one.

config.enable_stream(rs.stream.accel, rs.format.motion_xyz32f, 250)
config.enable_stream(rs.stream.gyro, rs.format.motion_xyz32f, 200)
frames = pipeline.wait_for_frames()
for frame in frames:
    motion_data = frame.as_motion_frame().get_motion_data()
    print(motion_data)
    # prints: x: -0.0294199, y: -7.21769, z: -6.41355 for me
    # to get numpy array:
    print(np.array([motion_data.x, motion_data.y, motion_data.z]))

gyro is similar. I think we can close this issue then,

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

3 participants