As discussed in Multi-camera issue: After connecting the sixth camera, its motion frame doesn't arrive · Issue #5828 · IntelRealSense/librealsense · GitHub .
I met a strange “failed to set power state” error by running rs-multicam
example.
I have a D435i and a D415 camera with both firmware 05.12.03.00.
First , the cameras both connected to the same usb3.0 hub on a ubuntu16.04 PC, it is OK.
Second, the cameras both connected to the same usb3.0 hub on Xavier with Jectpack 4.3 .
If using the realsense-viewer, I can see both camera stream , but if using c++ api , it crashed.
the test code is
rs2::context ctx; // Create librealsense context for managing devices
std::vector<rs2::pipeline> pipelines;
// Start a streaming pipe per each connected device
for (auto&& dev : ctx.query_devices())
{
rs2::pipeline pipe(ctx);
rs2::config cfg;
cfg.enable_device(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));
pipe.start(cfg);
pipelines.emplace_back(pipe);
}
It gives me
terminate called after throwing an instance of 'rs2::error'
what(): failed to set power state
Aborted
Although I fix the issue by comment cfg.enable_device(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));
this line, which caused the issue for some reason.
rs2::context ctx;// Create librealsense context for managing devices
// Declare RealSense pipeline, encapsulating the actual device and sensors
std::vector<rs2::pipeline> pipelines;
// Start a streaming pipe per each connected device
for (auto&& dev : ctx.query_devices())
{
rs2::pipeline pipe(ctx);
rs2::config cfg;
//uncomment this will rise a `failed to set power state`bug
//cfg.enable_device(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));
pipe.start(cfg);
pipelines.emplace_back(pipe);
}
It is wield that rs-multicam
works on PC but not on Xavier.
Hi,
There are one Type-A port and two type-C port on Xavier devkit. RealSense cameras require significant bandwidth. We would suggest you connect one to the Type-A port, and the other to the Type-C port with type C to A adapter.
thank you.
First, there is no use to connect one to the Type-A port, and the other to the Type-C port with type C to A adapter which I had tried already.
Change the start order will solve this problem. Start camera no.2 first .then camera no.1 . But still can not figure out why.
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_2.start(config_2)
pipeline_1.start(config_1)
Hi,
Please set sudo nvpmodel -m 0 and sudo jetson_clocks. Check if running the system in max performance helps.
We have tried two D435s and it works fine. One is connected to Type-A port and the other is connected to Type-C port with C to A adapter.
Thank you.
sudo nvpmodel -m 0 and sudo jetson_clocks has already been set before.
How did you test on two D435s? Don’t test on realsense-viewer, but on its API.
As I mentioned , two D435s work OK no matter mounted on a same hub or One is connected to Type-A port and the other is connected to Type-C port with C to A adapter if the start order is right.
For example , it will fail in this situation on Xavier but success on PC with GeForce GTX 1080.
python test code.
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)
C++ test code is here
rs2::context ctx; // Create librealsense context for managing devices
std::vector<rs2::pipeline> pipelines;
// Start a streaming pipe per each connected device
for (auto&& dev : ctx.query_devices())
{
rs2::pipeline pipe(ctx);
rs2::config cfg;
cfg.enable_device(dev.get_info(RS2_CAMERA_INFO_SERIAL_NUMBER));
pipe.start(cfg);
pipelines.emplace_back(pipe);
}
Just share my self experience.
Environment:
- Jetson Orin Nano
- Docker
- Librealsense SDK2.0
Devices:
- D435 x2
- D435i x1
All connected to Type-A USB hub with 5V power-supply, then hub to Type-C on Jetson
In my case, I followed the Librealsense SDK build from source methods: https://dev.intelrealsense.com/docs/nvidia-jetson-tx2-installation
Running on Docker,
First, I tried using Linux native kernel drivers for UVC, USB and HID (Video4Linux and IIO respectively).
D435i not found in container, but D435 would found.
Second, I tried using second methods: RSUSB Backend
. Both the D435/D435i not work and showing the same error on Jetson Orin Nano
:
failed to set power state
but my PC works fine.
Finally, when I check for the udev rules on my PC
cat /etc/udev/rules.d/99-realsense-libusb.rules
, and add the following code on Jetson Orin Nano
SUBSYSTEM=="usb", ATTR{idVendor}=="8086", GROUP="video", MODE="0666"
It works !!!
So maybe have a look at udev rules? And remember to get enough power supply for six realsense.