问题描述
我正在尝试从 D435i 相机获取 IMU 数据,但无法这样做。浏览各种 github 问题,我得到了很直接的代码片段,但由于某种原因它仍然无法正常工作。任何帮助将不胜感激。
以下是我正在使用的代码段:
import numpy as np
import pyrealsense2 as rs
pipeline = rs.pipeline()
config = rs.config()
config.enable_stream(rs.stream.accel,rs.format.motion_xyz32f,200)
config.enable_stream(rs.stream.gyro,200)
pipeline.start(config)
while True:
frames = pipeline.wait_for_frames()
for frame in frames:
motion_data = frame.as_motion_frame().get_motion_data()
print(np.array([motion_data.x,motion_data.y,motion_data.z]))
错误出现在第 pipeline.start(config)
行,它说 RuntimeError: Couldn't resolve requests
出于某种原因。我使用的 librealsense 版本是 2.14
解决方法
我认为您的程序失败了,因为 D435i 的陀螺仪和加速度计以不同的速率工作。
请参阅下面的示例以了解管道配置:
pipeline = rs.pipeline()
config = rs.config()
# Configuring streams at different rates
# Accelerometer available FPS: {63,250}Hz
config.enable_stream(rs.stream.accel,rs.format.motion_xyz32f,250) # acceleration
# Gyroscope available FPS: {200,400}Hz
config.enable_stream(rs.stream.gyro,200) # gyroscope
pipeline.start(config)
可在此处找到更多信息:https://www.intelrealsense.com/how-to-getting-imu-data-from-d435i-and-t265/