toinsson / pyrealsense

Cross-platform ctypes/Cython wrapper to the librealsense library (v1.x)
http://pyrealsense.readthedocs.io
Apache License 2.0
121 stars 46 forks source link

LIBUSB error while using SR300 camera #56

Closed kishankedia closed 7 years ago

kishankedia commented 7 years ago

Camera Model: SR300 Firmware Version: firmware': '3.21.0.0' Operating System & Version: macOS sierra 10.12.6 librealsense version: 1.12.1 pyrealsense version: 2.1

required info:

error: returned LIBUSB_ERROR_PIPE

CODE:

import logging
logging.basicConfig(level=logging.INFO)

import time
import numpy as np
import cv2
import pyrealsense as pyrs

with pyrs.Service() as serv:
    with serv.Device() as dev:

        dev.apply_ivcam_preset(0)
        for k in dev.get_available_options():
            print k

        while True:
            dev.wait_for_frames()

            c = dev.color
            c = cv2.cvtColor(c, cv2.COLOR_RGB2BGR)

            d = dev.depth * dev.depth_scale * 100
            d = d.astype(np.uint8)

            cv2.imwrite("test.png",d)
            d = cv2.imread("test.png")
            cd = np.concatenate((c, d), axis=1)

            cv2.imshow('', cd)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break
        print dev.depth_scale`

I am trying to print all available options that are available for the device. However i am getting this strange error. It was working fine for 2-3 times.

**error log** 

`ERROR:pyrealsense.utils:    uvc_get_ctrl(...) returned LIBUSB_ERROR_PIPE
Traceback (most recent call last):
  File "/Users/i325692/Desktop/depth/intel_realSR300/video_stream.py", line 31, in <module>
    for k in dev.get_available_options():
  File "//anaconda/lib/python2.7/site-packages/pyrealsense/core.py", line 373, in get_available_options
    return six.moves.zip(avail_opt_ranges, self.get_device_options(avail_opt))
  File "//anaconda/lib/python2.7/site-packages/pyrealsense/core.py", line 395, in get_device_options
    _check_error(e)
  File "//anaconda/lib/python2.7/site-packages/pyrealsense/utils.py", line 46, in _check_error
    pp(lrs.rs_get_error_message, e))
pyrealsense.utils.RealsenseError: rs_get_device_options(device:0x100800620, options:0x104e365c0, count:29, values:0x104e33640) crashed with: uvc_get_ctrl(...) returned LIBUSB_ERROR_PIPE`
toinsson commented 7 years ago

ERROR:pyrealsense.utils: uvc_get_ctrl(...) returned LIBUSB_ERROR_PIPE

this look like a librealsense issue, not related to pyrealsense.