librealsense: D435i timeouts Python


Required Info
Camera Model D435i
Firmware Version 05.10.13
Operating System & Version Linux (Ubuntu 18.04)
Kernel Version (Linux Only) 4.15.0-45-generic
Platform PC
SDK Version 2.19.1
Language python
Segment others

When multiple streams are enabled with gyroscope/acceloremeter, pipeline takes very long time to synchronize frames. If all 3 (depth/color/infrared) are enabled this didn’t return for over 5 minutes for me Both SDK and the apt packages updated.

import pyrealsense2 as rs
import numpy as np

def initialize_camera():
    #start the frames pipe
    p = rs.pipeline()
    conf = rs.config()
    CAM_WIDTH, CAM_HEIGHT, CAM_FPS = 848,480,15
#     conf.enable_stream(rs.stream.depth, CAM_WIDTH, CAM_HEIGHT, rs.format.z16, CAM_FPS)
    conf.enable_stream(rs.stream.color, CAM_WIDTH, CAM_HEIGHT, rs.format.rgb8, CAM_FPS)
    conf.enable_stream(rs.stream.infrared, CAM_WIDTH, CAM_HEIGHT, rs.format.y8, CAM_FPS)
    conf.enable_stream(rs.stream.accel,rs.format.motion_xyz32f,250)
    conf.enable_stream(rs.stream.gyro,rs.format.motion_xyz32f,200)
    prof = p.start(conf)
    return p
p = initialize_camera()

%%time
f = p.wait_for_frames(1000000) 

Returns in 30 seconds.

Related issue it appears: https://github.com/IntelRealSense/librealsense/issues/3108 Works fine in realsense-viewer though

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 41 (4 by maintainers)

Most upvoted comments


Hi tRosenflanz,

You may try this script. And I only saw 1~3 seconds delay printed out.

import pyrealsense2 as rs import numpy as np import time import cv2

def initialize_camera(): p = rs.pipeline() conf = rs.config() CAM_WIDTH, CAM_HEIGHT, CAM_FPS = 848,480,15 conf.enable_stream(rs.stream.depth, CAM_WIDTH, CAM_HEIGHT, rs.format.z16, CAM_FPS) conf.enable_stream(rs.stream.color, CAM_WIDTH, CAM_HEIGHT, rs.format.rgb8, CAM_FPS) conf.enable_stream(rs.stream.infrared, CAM_WIDTH, CAM_HEIGHT, rs.format.y8, CAM_FPS) conf.enable_stream(rs.stream.accel,rs.format.motion_xyz32f,250) conf.enable_stream(rs.stream.gyro,rs.format.motion_xyz32f,200) prof = p.start(conf) return p

t0 = time.time() pipeline = initialize_camera() print time.time() - t0, “seconds elapsed”

try: while True:

    frames = pipeline.wait_for_frames()
    depth_frame = frames.get_depth_frame()
    color_frame = frames.get_color_frame()
    if not depth_frame or not color_frame:
        continue

    depth_image = np.asanyarray(depth_frame.get_data())
    color_image = np.asanyarray(color_frame.get_data())

    depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET)

    images = np.hstack((color_image, depth_colormap))

    cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)
    cv2.imshow('RealSense', images)
    cv2.waitKey(1)

finally:

pipeline.stop()

I couldn’t get all the streams to open, but I still haven’t found the cause