IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.6k stars 4.83k forks source link

No device connected error / config.resolve(pipeline_wrapper) #11368

Closed simon-TUM closed 1 year ago

simon-TUM commented 1 year ago
Required Info
Camera Model D435I
Firmware Version 05.14.00.00
Operating System & Version Ubuntu 20.04
Kernel Version (Linux Only) 5.9.1-rt20
Platform PC
SDK Version LibRealSense v2.50.0
Language python
Segment Robot

Issue Description

Hi, I'm having some troubles. The following lines give me an error when running:

pipeline = rs.pipeline()
config = rs.config()
rospy.init_node('listen_extrinsic_matrices', anonymous=True)
bridge = CvBridge()
extrinsic_matrix_htc = rospy.Subscriber('extrinsic_matrix_from_hand_to_camera', Image, queue_size=10)
extrinsic_matrix_lth = rospy.Subscriber('extrinsic_matrix_from_link0_to_hand', Image, queue_size=10)

# Get device product line for setting a supporting resolution
pipeline_wrapper = rs.pipeline_wrapper(pipeline)
pipeline_profile = config.resolve(pipeline_wrapper)
device = pipeline_profile.get_device()
align = rs.align(rs.stream.depth)
pc = rs.pointcloud()

The error message is:

pipeline_profile = config.resolve(pipeline_wrapper)
RuntimeError: No device connected

I'm not sure what what the issue is. Realsense-viewer works and I've tried different cables but without success so far.

MartyG-RealSense commented 5 months ago

Does it make a difference to performance if you insert a Keep() instruction immediately after the wait_for_frames() instruction?

frames = pipeline.wait_for_frames()
frames.keep()
ianshi8 commented 5 months ago

@MartyG-RealSense The D435 actually does have an IR stream, and we're able to access it that way. However I'm now getting an "AttributeError: 'tuple' object has no attribute get_depth_frame". Do you know what the get_depth_frame() and get_color_frame() functions are trying to grab?

Printing frames gives me the tuple: (True, <pyrealsense2.frameset Z16 #2 @17164931112.23423 Y8 #1 @17164931112.23423>)

MartyG-RealSense commented 5 months ago

As the names suggest, get_depth_frame retrieves frames from the depth stream and get_color_frame retrieves frames from the color stream.

monajalal commented 1 month ago

@MartyG-RealSense

Hi @freetown113 What is the docker run instruction that you are using, please? Have you tried using sudo admin permissions and including the --privileged flag? For example:

sudo docker run --privileged -it --rm \ -v /dev:/dev \

could you please have a look at this issue?

https://github.com/Kaivalya192/live-pose/issues/3#issue-2532217439

Also, this is the command I ran for starting the docker container on Ubuntu 22.04 X86:

2024-09-17 17:47:33 [mona@DOS live-pose]$ cat docker/run_container.sh
docker rm -f livepose
DIR=$(pwd)/
xhost +  && docker run --gpus all --env NVIDIA_DISABLE_REQUIRE=1 -it --privileged --network=host --name livepose  --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -v $DIR:$DIR -v /home:/home -v /mnt:/mnt -v /tmp/.X11-unix:/tmp/.X11-unix -v /tmp:/tmp -v /dev/bus/usb:/dev/bus/usb --ipc=host -e DISPLAY=${DISPLAY} -e GIT_INDEX_FILE livepose:latest bash -c "cd $DIR && bash"
monajalal commented 1 month ago

@MartyG-RealSense got it fixed thanks a lot

Added -v /dev:/dev after -v /dev/bus/usb:/dev/bus/usb and now it is working.

MartyG-RealSense commented 1 month ago

Great news that you achieved a solution, @monajalal - thanks so much for the update and for sharing your solution!

monajalal commented 3 weeks ago

ctx = rs.context() devices = ctx.query_devices() for dev in devices: dev.hardware_reset()

@MartyG-RealSense

I have same issue. the test code to check if works

$ cat test_rs_camera.py 
import pyrealsense2 as rs
pipe = rs.pipeline()
print(pipe)
print(dir(pipe))
pipe.start()
print(pipe.get_active_profile())
pipe.stop()
$ python test_rs_camera.py 
<pyrealsense2.pipeline object at 0xffffa00d25b0>
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'get_active_profile', 'poll_for_frames', 'start', 'stop', 'try_wait_for_frames', 'wait_for_frames']
<pyrealsense2.pipeline_profile object at 0xffffa01085b0>

and I added these lines

and still get


   pipeline_profile = config.resolve(pipeline_wrapper)
RuntimeError: No device connected
MartyG-RealSense commented 3 weeks ago

Hi @monajalal Does the script run if launched in sudo admin permissions mode?

sudo python3 test_rs_camera.py

In regard to the hardware_reset() instruction, a hardware reset of the camera will disconnect the camera connection and then attempt to re-connect it. Sometimes the camera is not re-detected after the disconnection has occurred.

monajalal commented 3 weeks ago

@MartyG-RealSense could you please check https://github.com/IntelRealSense/librealsense/issues/13437 I created an issue for this with full details thanks a lot

MartyG-RealSense commented 3 weeks ago

I will check https://github.com/IntelRealSense/librealsense/issues/13437 - thanks very much.