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

Multi-camera issue: After connecting the sixth camera, its motion frame doesn't arrive #5828

Closed
wangroger0801 opened this issue Feb 11, 2020 · 90 comments

Comments

@wangroger0801
Copy link


Required Info
Camera Model D435i
Firmware Version 05.12.02.100
Operating System & Version Ubuntu 18.04
Kernel Version (Linux Only) 4.15.0-76 and 5.0.0-23
Platform PC
SDK Version 2.32.1
Language C++
Segment Others

Hardware: i7-9800X, Qudro RTX4000 , Nvidia driver 435.21

Issue Description

Hello,
We are going to use six or more cameras in our system. On windows10, all demos from sdk are fine without problem.

On Ubuntu, different errors start appearing after plug in more cameras.
The main issue which stop us developing is we cam not use the motion frame from the sixth camera. (In demo rs-multicam, it only show 5 cameras when 6 are plugged in).
Could your team check how we could fix this issue? Thanks!

Monitoring the frame data from the Realsense Viewer.
Testing procedures:

  1. plug in one camera
  2. start depth frame,color frame, motion frame
  3. read error message
  4. plug in the next camera

First CAM

 11/02 10:56:43,100 WARNING [140697856358144] (ds5-timestamp.cpp:76) UVC metadata payloads not available. Please refer to the installation chapter for details.
 11/02 10:56:43,881 WARNING [140697466291968] (backend-hid.cpp:681) HID set_power 1 failed for /sys/devices/pci0000:00/0000:00:14.0/usb2/2-10/2-10.2/2-10.2:1.5/0003:8086:0B3A.0006/HID-SENSOR-200073.1.auto/iio:device0/buffer/enable

Second CAM

Third CAM

 11/02 10:58:39,747 ERROR [140698292938496] (types.h:304) get_dev_capabilities: Cannot open '/dev/video17 Last Error: Permission denied
 11/02 10:58:39,749 ERROR [140698292938496] (types.h:304) get_dev_capabilities: Cannot open '/dev/video15 Last Error: Permission denied
 11/02 10:58:39,750 ERROR [140698292938496] (types.h:304) get_dev_capabilities: Cannot open '/dev/video13 Last Error: Permission denied
 11/02 10:58:39,751 ERROR [140698292938496] (types.h:304) get_dev_capabilities: Cannot open '/dev/video16 Last Error: Permission denied
 11/02 10:58:39,751 ERROR [140698292938496] (types.h:304) get_dev_capabilities: Cannot open '/dev/video14 Last Error: Permission denied
 11/02 10:58:39,751 ERROR [140698292938496] (types.h:304) get_dev_capabilities: Cannot open '/dev/video12 Last Error: Permission denied

4th CAM

 11/02 11:00:05,162 ERROR [140698292938496] (backend-v4l2.cpp:598) Metadata node for uvc device: id- /dev/video22
vid- 8086
pid- b3a
mi- 3
unique_id- 6-1-2
path- /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:02.0/0000:1a:00.0/usb6/6-1/6-1:1.3/video4linux/video22
susb specification- 320
metadata node-/dev/video23 was already been assigned 

5th CAM

 11/02 11:00:50,402 ERROR [140698292938496] (backend-v4l2.cpp:598) Metadata node for uvc device: id- /dev/video28
vid- 8086
pid- b3a
mi- 3
unique_id- 4-1-2
path- /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1:1.3/video4linux/video28
susb specification- 320
metadata node-/dev/video29 was already been assigned

6th CAM

vid- 8086
pid- b3a
mi- 3
unique_id- 4-1-2
path- /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1:1.3/video4linux/video28
susb specification- 320
metadata node-/dev/video29 was already been assigned 

After enabling the Motion Frame from the 6th CAM
All the frame reading disappeared on the viewer, shows:

** Nothing is streaming Tolggle to start**

 11/02 11:03:56,218 WARNING [140692013688576] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 11/02 11:03:56,218 WARNING [140692022081280] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds

 11/02 11:06:37,534 WARNING [140698442491776] (types.cpp:49) Accel Sensitivity:hwmon command 0x4f failed. Error type: No data to return (-21).

Error from realsense viewer log

Error Viewer 
Timestamp: 1581415405023.902832
Severity: Error
Description: USB SCP overflow
 
Severity: Error
Description: USB CAM overflow

Samples from dmesg errors:

[   55.715070] usb 2-10.2: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
[   55.735643] usb 2-10.2: New USB device found, idVendor=8086, idProduct=0b3a, bcdDevice=50.c2
[   55.735646] usb 2-10.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   55.735649] usb 2-10.2: Product: Intel(R) RealSense(TM) Depth Camera 435i
[   55.735651] usb 2-10.2: Manufacturer: Intel(R) RealSense(TM) Depth Camera 435i
[   55.735653] usb 2-10.2: SerialNumber: 934123056218
[   55.761916] media: Linux media interface: v0.10
[   55.765328] PKCS#7 signature not signed with a trusted key
[   55.767741] PKCS#7 signature not signed with a trusted key
[   55.771439] videodev: Linux video capture interface: v2.00
[   55.783411] PKCS#7 signature not signed with a trusted key
[   55.783975] PKCS#7 signature not signed with a trusted key
[   55.785131] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435i (8086:0b3a)
[   55.790400] uvcvideo: Unable to create debugfs 2-4 directory.
[   55.790612] uvcvideo 2-10.2:1.0: Entity type for entity Intel(R) RealSense(TM) Depth Ca was not initialized!
[   55.790617] uvcvideo 2-10.2:1.0: Entity type for entity Processing 2 was not initialized!
[   55.790621] uvcvideo 2-10.2:1.0: Entity type for entity Camera 1 was not initialized!
[   55.791583] input: Intel(R) RealSense(TM) Depth Ca as /devices/pci0000:00/0000:00:14.0/usb2/2-10/2-10.2/2-10.2:1.0/input/input24
[   55.792019] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435i (8086:0b3a)
[   55.795587] uvcvideo: Unable to create debugfs 2-4 directory.
[   55.795727] uvcvideo 2-10.2:1.3: Entity type for entity Processing 7 was not initialized!
[   55.795729] uvcvideo 2-10.2:1.3: Entity type for entity Extension 8 was not initialized!
[   55.795731] uvcvideo 2-10.2:1.3: Entity type for entity Camera 6 was not initialized!
[   55.795840] usbcore: registered new interface driver uvcvideo
[   55.795841] USB Video Class driver (1.1.2.realsense-1.3.13)
[   55.883103] hid-sensor-hub 0003:8086:0B3A.0006: No report with id 0xffffffff found
[   57.220030] uvcvideo: Failed to query (GET_CUR) UVC control 1 on unit 3: -32 (exp. 1024).
[   57.270942] uvcvideo: Failed to query (GET_CUR) UVC control 1 on unit 3: -32 (exp. 1024).
... more UVC control errors ...
[   61.560912] uvcvideo: Failed to query (GET_CUR) UVC control 1 on unit 3: -32 (exp. 1024).
[   61.739843] hid-sensor-hub 0003:8086:0B3A.0006: No report with id 0xffffffff found

After searching on the closed issues here, it seems to be a kernel patch problem. But we did install librealsense-dkms package.

Loading the modified modules into kernel... complete
Current status:
librealsense2-dkms, 1.3.13, 4.15.0-76-generic, x86_64: installed
librealsense2-dkms, 1.3.13, 5.0.0-23-generic, x86_64: installed
nvidia, 435.21, 4.15.0-76-generic, x86_64: installed
nvidia, 435.21, 5.0.0-23-generic, x86_64: installed
mod: videodev 			 version: realsense2-dkms
mod: uvcvideo 			 version: 1.1.2.realsense-1.3.13
mod: hid_sensor_gyro_3d 	 version: realsense2-dkms
mod: hid_sensor_accel_3d 	 version: realsense2-dkms

verified by: modinfo uvcvideo | grep "version:"

version:        1.1.2.realsense-1.3.13
srcversion:     675D90F9B82D78E0628E213

We also tried install patch manually under Ubuntu (the official guide) and Arch Linux, under kernel 5.0 and 5.1. following the guide from closed issue #4271 , but we have the same problem.

It seems not caused by a bandwidth or cable problem. 4 in 6 cameras are connected to dedicated USB3.1 ports and everything works fine on windows
USB connection verified by lsusb --tree

/:  Bus 12.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 11.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
/:  Bus 10.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 1, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 2, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 3, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 4, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 5, Class=Human Interface Device, Driver=usbhid, 5000M
/:  Bus 09.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/:  Bus 08.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 1, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 2, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 3, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 4, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 5, Class=Human Interface Device, Driver=usbhid, 5000M
/:  Bus 07.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/:  Bus 06.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 1, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 2, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 3, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 4, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 5, Class=Human Interface Device, Driver=usbhid, 5000M
/:  Bus 05.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 1, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 2, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 3, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 4, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 1: Dev 2, If 5, Class=Human Interface Device, Driver=usbhid, 5000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 5000M
    |__ Port 3: Dev 14, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 5: Dev 5, If 0, Class=Hub, Driver=hub/2p, 5000M
        |__ Port 2: Dev 6, If 0, Class=Hub, Driver=hub/2p, 5000M
            |__ Port 2: Dev 7, If 4, Class=Video, Driver=uvcvideo, 5000M
            |__ Port 2: Dev 7, If 2, Class=Video, Driver=uvcvideo, 5000M
            |__ Port 2: Dev 7, If 0, Class=Video, Driver=uvcvideo, 5000M
            |__ Port 2: Dev 7, If 5, Class=Human Interface Device, Driver=usbhid, 5000M
            |__ Port 2: Dev 7, If 3, Class=Video, Driver=uvcvideo, 5000M
            |__ Port 2: Dev 7, If 1, Class=Video, Driver=uvcvideo, 5000M
    |__ Port 9: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 10: Dev 3, If 0, Class=Hub, Driver=hub/2p, 5000M
        |__ Port 2: Dev 4, If 5, Class=Human Interface Device, Driver=usbhid, 5000M
        |__ Port 2: Dev 4, If 3, Class=Video, Driver=uvcvideo, 5000M
        |__ Port 2: Dev 4, If 1, Class=Video, Driver=uvcvideo, 5000M
        |__ Port 2: Dev 4, If 4, Class=Video, Driver=uvcvideo, 5000M
        |__ Port 2: Dev 4, If 2, Class=Video, Driver=uvcvideo, 5000M
        |__ Port 2: Dev 4, If 0, Class=Video, Driver=uvcvideo, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/16p, 480M
    |__ Port 5: Dev 6, If 0, Class=Hub, Driver=hub/2p, 480M
        |__ Port 2: Dev 7, If 0, Class=Hub, Driver=hub/2p, 480M
    |__ Port 10: Dev 2, If 0, Class=Hub, Driver=hub/2p, 480M
        |__ Port 1: Dev 5, If 2, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 1: Dev 5, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 1: Dev 5, If 1, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 11: Dev 3, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 11: Dev 3, If 1, Class=Wireless, Driver=btusb, 12M
@schmiran
Copy link

schmiran commented Feb 12, 2020

Hello, I have the same problem.

I am running Ubuntu 18.04.4 LTS - 5.3.0-28-generic. The installation of realsense 2.32.1 via the Debian package worked without error messages. Also the kernel patch:

version:        1.1.2.realsense-1.3.13
srcversion:     3DD05991EAABF8F5DE4E188

Whether I use the sensors inside ROS or just the realsense-viewer. Starting with the 4th sensor I get the error message:

12/02 11:14:27,013 ERROR [140128714475264] (backend-v4l2.cpp:598) Metadata node for uvc device: id- /dev/video20
vid- 8086
pid- ad3
mi- 3
unique_id- 6-1-14
path- /sys/devices/pci0000:00/0000:00:1c.0/0000:04:00.0/0000:05:02.0/0000:2c:00.0/usb6/6-1/6-1:1.3/video4linux/video20
susb specification- 320
metadata node-/dev/video21 was already been assigned

I have exchanged the cables, as well as the ports, the error always comes with the 4th connected sensor regardless of the configuration.

I also have the problem that if I connected the sensors via a Thunderbolt 3 hub like before, there are no more frames when the sensor is turned off and on again. Operation via the hub was no problem before.

Despite the error message starting with the 4th sensor, I get data in realsense-viewer as long as I do not run the sensors over the hub. What does not work is to work with the sensors in ROS. The nodes that subscribe to the corresponding channels of the sensors don't get any data anymore. This was running without problems before and no changes were made at this point by me.

In about one of 30 attempts my ROS configuration works and I can work with the sensor data as usual. Why it sometimes works and sometimes not is not reproducible for me. If it does not work I either get the following error message from t265:

[ WARN] [1581501726.513505941]: Error extracting usb port from device with physical ID: 2-1-8

Or I get an error message that the camera_manager has died. Unfortunately the log file cannot be found.

[t265/realsense2_camera_manager-9] process has died [pid 24803, exit code -6, cmd /opt/ros/melodic/lib/nodelet/nodelet manager __name:=realsense2_camera_manager __log:=/home/*******/.ros/log/f91c51d4-516d-11ea-aa23-50eb711aef87/t265-realsense2_camera_manager-9.log].
log file: /home/******/.ros/log/f91c51d4-516d-11ea-aa23-50eb711aef87/t265-realsense2_camera_manager-9*.log

I have also noticed that the physical port on the T265 is e.g. 2-1-8, whereas on the other sensors (2x D435, 1x D415) it is like: sys/devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1:1.0/video4linux/video4

With the t265 I also noticed that the serial number has changed since realsense 2.32.1. Four zeros were added at the front.

I hope you can help me, I'm a bit confused why my system doesn't work as usual anymore.
Greetings

@wangroger0801
Copy link
Author

wangroger0801 commented Feb 12, 2020

Hello @schmiran ,

Today we rebuilt the library from development branch (Latest commit d3980b2). We also apply the patch manually.
New library v2.32.1 and new firmware 5.12.02.100
It seems that we get rid of the error messages saying metadata node-/dev/video23 was already been assigned . Is it something you can do a try-out?

However the motion frame is still not arrived from the sixth cameras
New error messages when I switch on/off Motion Module on the camera with issue.

 12/02 14:30:14,929 WARNING [140421577557760] (backend-hid.cpp:681) HID set_power 1 failed for /sys/devices/pci0000:00/0000:00:14.0/usb2/2-3/2-3:1.5/0003:8086:0B3A.0001/HID-SENSOR-200073.1.auto/iio:device0/buffer/enable
 12/02 14:30:23,727 WARNING [140419912423168] (backend-hid.h:68) write_fs_attribute Could not change gyro_3d-dev11 to gyro_3d-dev1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/trigger/current_trigger
 12/02 14:30:23,730 WARNING [140419920815872] (backend-hid.h:68) write_fs_attribute Could not change 0 to 1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:23,730 WARNING [140419920815872] (backend-hid.cpp:681) HID set_power 1 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:24,571 WARNING [140419920815872] (backend-hid.cpp:681) HID set_power 0 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:25,710 WARNING [140419895637760] (backend-hid.h:68) write_fs_attribute Could not change  to gyro_3d-dev1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/trigger/current_trigger
 12/02 14:30:25,715 WARNING [140419904030464] (backend-hid.h:68) write_fs_attribute Could not change 0 to 1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:25,715 WARNING [140419904030464] (backend-hid.cpp:681) HID set_power 1 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:30,719 WARNING [140419912423168] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:30,720 WARNING [140419887245056] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:32,982 WARNING [140419904030464] (backend-hid.cpp:681) HID set_power 0 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:35,499 WARNING [140419887245056] (backend-hid.h:68) write_fs_attribute Could not change  to gyro_3d-dev1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/trigger/current_trigger
 12/02 14:30:35,503 WARNING [140419912423168] (backend-hid.h:68) write_fs_attribute Could not change 0 to 1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:35,503 WARNING [140419912423168] (backend-hid.cpp:681) HID set_power 1 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:40,507 WARNING [140419920815872] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:40,507 WARNING [140419895637760] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:45,511 WARNING [140419895637760] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:45,511 WARNING [140419920815872] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:50,515 WARNING [140419920815872] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:50,515 WARNING [140419895637760] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:55,519 WARNING [140419895637760] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:55,519 WARNING [140419920815872] (backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds
 12/02 14:30:57,315 WARNING [140419912423168] (backend-hid.cpp:681) HID set_power 0 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:59,312 WARNING [140419895637760] (backend-hid.h:68) write_fs_attribute Could not change  to gyro_3d-dev1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/trigger/current_trigger
 12/02 14:30:59,316 WARNING [140419920815872] (backend-hid.h:68) write_fs_attribute Could not change 0 to 1 : path /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:30:59,316 WARNING [140419920815872] (backend-hid.cpp:681) HID set_power 1 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable
 12/02 14:31:00,299 WARNING [140419920815872] (backend-hid.cpp:681) HID set_power 0 failed for /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:01.0/0000:19:00.0/usb4/4-1/4-1.2/4-1.2.2/4-1.2.2:1.5/0003:8086:0B3A.000B/HID-SENSOR-200076.22.auto/iio:device11/buffer/enable

@wangroger0801
Copy link
Author

Well... I found out the same error metadata node-/dev/video23 was already been assigned after I enable the advanced mode in realsense viewer

@schmiran
Copy link

Hey @wangroger0801 ,

so installing the development branch didn't help after all? I'll try it this afternoon and let you know.

Regarding your error message with the frames:

(backend-hid.cpp:598) iio_hid_sensor: Frames didn't arrived within 5 seconds

I get the same error message when I run sensors across the Hub. Even on the first sensor. If I connect them directly to the system, I don't get that error message.

@schmiran
Copy link

For the problem with the wrong physical ID I found this IntelRealSense/realsense-ros#1051 (comment) and will test it later.

@schmiran
Copy link

Hey @wangroger0801 ,

I have now also tested the developer branch, without changes. The other hint about the physical ID couldn't help me either.

Do you have new information? Or maybe @RealSenseCustomerSupport has an idea what causes the error messages?

@wangroger0801
Copy link
Author

wangroger0801 commented Feb 19, 2020

Hello @schmiran ,

Thanks for your reply. We did a new test. It fixed the motion frame not arrived problem. But more errors pop out. We still can't using 6 cameras. I am sure it not hub related it works fine on Windows.

We added -DFORCE_RSUSB_BACKEND=true to the SDK cmake. In realsense-viewer , there is no motion frame error when 6 cameras is connected. But there seems an up-limit of video frame data. No video frames received from the third 720p@30Hz RGB frames. To enable all 6 RGB and depth frames plus 6 infrared frames we have to set the resolution to 360p or even lower on some cameras.

Although we did enable all the frames in realsense viewer, our multi-cam program failed to start. It reported failed to set power state when there are more than 1 camera connected.

@RealSenseCustomerSupport any idea how we can fix this issue?
Thanks.

@schmiran
Copy link

With the new Realsense version it works again. I still have the problem, that if I switch the sensor off and on again, no more frames are coming but this can be solved with an initial reset in the launchfile.

I hope the new version has helped you too. It's a pity that there was no support for this topic.

Greetings

@tispratik
Copy link

We're facing the same issue. When we connect the 2nd camera, we get "Cannot set power state" error.

Required Info
Camera Model D400
Firmware Version 05.12.03.00
Operating System & Version Ubuntu 16.04
Kernel Version (Linux Only) 4.15.0-88-generic
Platform -
SDK Version 2.33.1
Language python
Segment Robot

@tispratik
Copy link

I can't seem to find documentation regarding low power mode 672b33b

In our 2nd camera, we need to run only RGB stream. Can we run it in low power mode to get around the cannot set power state issue?

@tispratik
Copy link

Interestingly when I run the RGB only streaming camera first and then the first camera which does RGB + Depth streaming, both the cameras run fine. Seems like when i run the RGB+Depth camera first, it takes up more power than it needs and then does not leave any for the RGB only streaming Realsense camera.

Need some way to limit the resources consumed by each Realsense camera.

@tispratik
Copy link

void rs_uvc_device::set_power_state(power_state state)
{
    _action_dispatcher.invoke_and_wait([&, this](dispatcher::cancellable_timer c)
    {
        if(state != _power_state)
        {
            switch(state)
            {
                case D0:
                    _messenger = _usb_device->open(_info.mi);
                    if (_messenger)
                    {
                        listen_to_interrupts();
                        _power_state = D0;
                    }
                    break;
                case D3:
                    if(_messenger)
                    {
                        close_uvc_device();                            
                        _messenger.reset();
                    }
                    _power_state = D3;
                    break;
            }
        }
    }, [this, state](){ return state == _power_state; });

    if(state != _power_state)
        throw std::runtime_error("failed to set power state");
}

The 2nd camera (RGB only) is unable to open the USB device for some reason when the 1st camera (RGB + Depth) is fired up first.

From the above function, seems like D0 is the power state.

@tispratik
Copy link

@MartyG-RealSense any thoughts on this one?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 25, 2020

@tispratik This link may give you a useful lead:

#5782

@tispratik
Copy link

tispratik commented Mar 25, 2020

Thanks Marty. I had seen that, but does not seem to apply to our case. Our case is 1 camera streaming depth+RGB connected to USB 3.1 port and another camera streaming only RGB stream connected to a USB 3.0 4Amps hub which is in turn connected to another USB 3.0 port on the same motherboard.

We have the exact same issue on 3 sets of our machines, so it is a reproducible problem. Interesting to note is that when we run the RGB only camera first, then the RGB+depth camera, both play along nicely on power. But if we run the RGB+depth camera first, then the RGB only camera gives the error of "cannot set power state".

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 25, 2020

@tispratik It sounds as though one camera is connected to the hub and one is connected directly to the computing device. If that is the case, connecting both to the hub should allow both cameras to be handled by the hub's USB controllers.

@tispratik
Copy link

Yes, we tried connecting both cameras to the hub as well as both cameras directly to the motherboard. We see the same issue.

@tispratik
Copy link

Update:

Even though we could run the two cameras by starting the RGB camera first and then the RGB+depth one, the RGB camera dies after some time. Following is what i see in dmesg.

[Wed Mar 25 02:43:11 2020] perf: interrupt took too long (2504 > 2500), lowering kernel.perf_event_max_sample_rate to 79750
[Wed Mar 25 05:55:53 2020] perf: interrupt took too long (3149 > 3130), lowering kernel.perf_event_max_sample_rate to 63500
[Wed Mar 25 18:47:15 2020] usb 2-3: Process 9334 (python) called USBDEVFS_CLEAR_HALT for active endpoint 0x84
[Wed Mar 25 18:47:24 2020] usb 2-3: Process 9334 (python) called USBDEVFS_CLEAR_HALT for active endpoint 0x84

@tispratik
Copy link

A little research on the error points me to https://www.spinics.net/lists/linux-usb/msg102772.html
The Kernel is logging a warning that USBDEVFS_CLEAR_HALT was called and it is wrong to call that function when URBs are queued.

The usb_clear_halt() function is being called from librealsense library to reset the endpoint which I am not sure why the camera is trying to do. Seems like the URBs need to be cleared before resetting the end point. This seems like a bug to me @MartyG-RealSense.

usb_status usb_messenger_libusb::reset_endpoint(const rs_usb_endpoint& endpoint, uint32_t timeout_ms)
{
    int ep = endpoint->get_address();               
    auto sts = libusb_clear_halt(_handle->get(), ep);
    if(sts < 0)
    {
        std::string strerr = strerror(errno);
        LOG_WARNING("reset_endpoint returned error, index: " << ep << ", error: " << strerr << ", number: " << int(errno));
        return libusb_status_to_rs(sts);
    }
    return RS2_USB_STATUS_SUCCESS;
}

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 25, 2020

@tispratik These 'lowering kernel' messages are a Linux kernel issue rather than a Librealsense error. A cause of the messages you experienced in the post above can apparently be high CPU load.

If you are having kernel and patching problems then maybe you could consider the backend SDK installation method that does not rely on kernel versions and patching. You will need an internet connection though.

https://support.intelrealsense.com/hc/en-us/community/posts/360037657234/comments/360009799533

@tispratik
Copy link

Thanks Marty. Do you mean to say that we should set the flag -DFORCE_RSUSB_BACKEND=true.. our current flags are

-DBUILD_EXAMPLES=true -DENFORCE_METADATA=true -DBUILD_PYTHON_BINDINGS=true -DFORCE_LIBUVC=true -DBUILD_WITH_CUDA=true -DIMPORT_DEPTH_CAM_FW=false

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 26, 2020

Yes, set -DFORCE_RSUSB_BACKEND=true

@wangroger0801
Copy link
Author

@MartyG-RealSense Thanks for your support.
Our initial error was not related to set power state and the error occurred only after the sixth camera was connected.
The realsense viewer said
iio_hid_sensor: Frames didn't arrived within 5 seconds

I also tired -DFORCE_RSUSB_BACKEND=true. But it did not work, as I mentioned before.

@MartyG-RealSense
Copy link
Collaborator

My understanding is that a mains-powered USB 3 hub can supply about 12 W of power, and each individual RealSense 400 Series camera requires 2 W. So I wonder if your sixth camera has insufficient power available. If each hub has 12 W available, using more than one powered hub may help, putting some of the cameras on the second hub. In the USB specification, up to five hubs can be connected together (a setup known as '5 deep').

@wangroger0801
Copy link
Author

We have a PCI-E USB adapter which should give sufficient power. And It doesn't explain the reason why it works on windows with the exact configuration.

@MartyG-RealSense
Copy link
Collaborator

A PCI-E USB adapter will still be drawing the power for the port from the computer's power supply unit in the same way that the built-in USB ports do (i.e they are 'passive' ports on the adapter and vulnerable to instabilities like the built-in ports).

Are you using Windows and Ubuntu in dual-boot on the same computer, please?

@wangroger0801
Copy link
Author

It is using PCI-E x4 which should give 25W power to the USB ports.
We did try windows, ubuntu and archlinux. Yes in dual-boot mode. Also, the possible secure boot option cause was eliminated.

@MartyG-RealSense
Copy link
Collaborator

The amount of wattage is important but not the only factor. I have seen cases involving 650 W power supply units on enterprise servers where camera disconnections could still occur. The stability of the power supplied to the port matters as much as the amount of wattage supplied. Mains-powered external USB hubs give greater power stability than the internal power supply units of computers.

At this point, I will refer the case internally to a support team manager to see if they can provide advice. I apologise for the delay in the meantime.

@tispratik
Copy link

tispratik commented Mar 27, 2020

I could reliably reproduce the problem with the below script. You will need two cameras for running the script.

import pyrealsense2 as rs
import numpy as np
import cv2

devices = rs.context().query_devices()

pipeline_1 = rs.pipeline()
pipeline_2 = rs.pipeline()

config_1 = rs.config()
config_2 = rs.config()
config_1.enable_device(devices[0].get_info(rs.camera_info.serial_number))
config_2.enable_device(devices[1].get_info(rs.camera_info.serial_number))

config_1.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 60)
config_1.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 60)
config_2.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 60)
config_2.enable_stream(rs.stream.color, 640, 480, rs.format.rgb8, 60)

pipeline_1.start(config_1)
pipeline_2.start(config_2)


while True:
    frames_1 = pipeline_1.wait_for_frames()
    frames_2 = pipeline_2.wait_for_frames()
    color_frame_1 = frames_1.get_color_frame()
    color_frame_2 = frames_2.get_color_frame()

    color_image_1 = np.asanyarray(color_frame_1.get_data())
    color_image_2 = np.asanyarray(color_frame_2.get_data())

    cv2.namedWindow('CAM 1', cv2.WINDOW_AUTOSIZE)
    cv2.imshow('CAM 1', color_image_1)

    cv2.namedWindow('CAM 2', cv2.WINDOW_AUTOSIZE)
    cv2.imshow('CAM 2', color_image_2)

    cv2.waitKey(1)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

The above script as is may or may not work for you. What is very whacky about the whole issue is that if you swap the order of starting the pipelines 1 and 2......it works!! The order in which we start the two pipelines matters for some unknown reason which the Realsense team needs to dig into.

Try:

pipeline_1.start(config_1)
pipeline_2.start(config_2)

vs:

Swap pipelines start:

pipeline_2.start(config_2)
pipeline_1.start(config_1)

@RealSenseSupport
Copy link
Collaborator

The compilation error is related to #6573 and will be addressed in PR #6581.
Closing this ticket as the multi-camera via RSUSB backend issue has been fixed in the SDK v2.35.2.
We will continue to track the compilation issue in another ticket.
Please feel free open a new ticket for other issue. Thank you.

@tispratik
Copy link

Any update on this issue? The compilation issue is separate. We see that this hasn't been fixed yet.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 3, 2020

@tispratik If you are getting that compilation error when trying to build SDK 2.35.2 from source with BUILD_WITH_CUDA=true, 2.35.2 has a bug that causes build to fail when CUDA is true in the CMake build statement.

A fix has been developed for the next version of the SDK. The bug can also be corrected with a method in the link below:

#6573 (comment)

@tispratik
Copy link

We are not getting the compilation failure after the fix we applied based on an earlier comment in this ticket.
Problem is the multi camera disconnection issue is not solved.

This issue #5828 (comment) still persists.

@MartyG-RealSense
Copy link
Collaborator

The multi-camera improvements were designed to address multicam problems related to rs::pipeline. It was acknowledged though that it may not correct every multicam problem, especially if the problem was related to the model of USB hub being used.

@tispratik
Copy link

Marty. I am frustrated that we are dilly dallying the issue. There is no connection to USB Hub. It was a test we did to see if it helps to add a hub. The hub does not help as well. It is such an easily reproducible issue. We have bought 100 intel cameras so far during our R&D phase, now we are in production, but still facing the issue. We have been forced to use a regular RGB camera as our second camera to pair up with the 1st Realsense camera. Why can't we have a 2 Realsense camera setup going??

@MartyG-RealSense
Copy link
Collaborator

An approach that other Python users have used when configuring cameras 1 and 2 is to structure the lines like this:

config_1.enable_device('013102060174')

In comparison, you use this line:

config_1.enable_device(devices[0].get_info(rs.camera_info.serial_number))

So if you test your script using the exact serial numbers of the two cameras that you are using and there are no problems, this would suggest that the problem may be with how your line is retrieving the serial number.

A single RealSense camera does not need a serial number. A serial number is only needed if there is more than one camera, to differentiate between the devices. If it cannot recognise more than one RealSense camera serial number, it suggests that it is not successfully checking the serial numbers and so behaving in its default mode (using only one camera in the absence of a serial number).

@tispratik
Copy link

tispratik commented Jul 3, 2020

The list of devices is coming from Realsense API itself. Not sure what wrong we can do retrieving the serial numbers from the device object using devices[x].get_info(rs.camera_info.serial_number)

@tispratik
Copy link

We got the list of serial numbers using the below command:

$ rs-enumerate-devices --short
Device Name                   Serial Number       Firmware Version
Intel RealSense D415          909522060991        05.12.03.00
Intel RealSense D415          839112061034        05.12.03.00

@MartyG-RealSense
Copy link
Collaborator

The pyrealsense2 documentation for the format of enable_device instructions is here:

https://intelrealsense.github.io/librealsense/python_docs/_generated/pyrealsense2.config.html#pyrealsense2.config.enable_device

@keithahern
Copy link

keithahern commented Jul 16, 2020

RuntimeError: failed to set power state is happening for me on OSX with 2 x 415 cameras on FW 05.12.06.00, from latest code today (2.36.0).

I modified the device manager to use serial number strings as suggested above but it didn't help.

I'm trying to run box_dimensioner_multicam_demo.py before starting a multi camera project. Code runs with either camera connected but not both.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 16, 2020

@keithahern Does use of the serial numbers make a difference if you unplug the two cameras and then re-insert them in a particular order, as suggested earlier in this discussion:

#5828 (comment)

@keithahern
Copy link

@MartyG-RealSense no difference. Tried with the both the api serial id code and the hardcoded id code.

Both plugged into 2019 MacBook Pro.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 16, 2020

@keithahern Are you able to test the cameras with another multicam program such as rs-multicam on your Mac, or stream two cameras at the same time in RealSense Viewer, to confirm whether your computer can stream two cameras simultaneously?

@keithahern
Copy link

keithahern commented Jul 16, 2020 via email

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 16, 2020

@keithahern My research indicates that when failed to set power state occurs with multiple cameras on Python, it tends to be related to the device manager script in box_dimensioner_multicam or self-created projects that use an adaptation of that device manager script.

I tracked down an alternative Python multicam script that you could test to see if it can be used as a basis for your project.

#1735 (comment)

@keithahern
Copy link

thanks Marty,

The code you reference actually has the same problem:
/Users/Dev/PycharmProjects/multicam-demo/venv/bin/python /Users/Dev/PycharmProjects/multicam-demo/opencv_viewer_example.py
Traceback (most recent call last):
File "/Users/Dev/PycharmProjects/multicam-demo/opencv_viewer_example.py", line 26, in
pipeline_2.start(config_2)
RuntimeError: failed to set power state

@keithahern
Copy link

ok, on a hunch I changed the cables I am using, which are these high quality cables, recommended by RealSense. I am using the 5m cables.

https://www.ntcdistributing.com/usb-3-1-type-c/a-to-c/usb-3-1-a-male-to-c-male-with-dual-screw-locking-cable/

Now the interesting thing is that running 2 x 415s with these cables in the RealSense Viewer showing both depth and rgb at max res is fine. In fact I have run 4 cameras/cables without problems.

So here are my results:
box_dimensioner_multicam.py, long cable, all runs,RuntimeError: failed to set power state
opencv_viewer_example.py, long cable, 1st run, RuntimeError: failed to set power state
box_dimensioner_multicam.py, short cable, all runs, RuntimeError: failed to set power state
opencv_viewer_example.py, short cable, 1st run, working
opencv_viewer_example.py, long cable, 2nd run, now working

It's weird that opencv_viewer_example.py is now working with my long cables. Perhaps they weren't inserted properly (but RealSense viewer worked on the 1st run...).

Either way the example code in the distribution is not working. Perhaps this helps.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jul 16, 2020

@keithahern Great news that you achieved positive results from your cable change!

The high-quality USB cable supplier now officially recommended by the official data sheet document for the 400 Series cameras is Newnex. I have seen past reports from RealSense users that NTC Distributing cables have worked for them too though.

image

@alexisburns91
Copy link

I've been following this thread for over a month because I have been having the same issue. The solve was changing the cables? I'm already using the cables that came with my cameras (d435 and d435i). I purchased a powered USB hub in case my nuc wasn't providing enough power for both. I am still having this issue.

@keithahern
Copy link

keithahern commented Jul 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants