Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I bought an Intel RealSense T265 camera and I am testing out the following example:

import pyrealsense2 as rs

import cv2

# Get realsense pipeline
pipe = rs.pipeline()

# Configure the pipeline
cfg = rs.config()
cfg.enable_stream(rs.stream.pose) # Positional data (translation, rotation, velocity etc)

# Start the configured pipeline
pipe.start(cfg)

for _ in range(10):
    frames = pipe.wait_for_frames()
    pose = frames.get_pose_frame()
    if pose:
        data = pose.get_pose_data()
        print('Position: ', data.translation)
    
    else:
        pipe.stop(cfg)

    cv2.waitKey(50)

The example runs great the first time, but when I try to re-run it, it gives me the following RuntimeError: "No device connected" and references the "pipe.start(cfg)" line. If I re-run the script it works again. In other words, if I just keep tapping "F5" to run the script, it will work, crash, work, crash, etc...

My question is, how do I restart the pipeline so it recognizes my device every time I run the script?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...