- 
                Notifications
    You must be signed in to change notification settings 
- Fork 4.9k
Description
I am using an ubuntu 20.04 noetic computer.
The realsense d435 is connected directly to the USB port of this computer via a cable.
I want to run video_output.py to record video from my realsense d435, but it says no device connected.
~/catkin_ws/src/librealsense/scripts$ rosrun nav_metrics_tools video_output.py
Traceback (most recent call last):
File "/home/whill/catkin_ws/devel/lib/nav_metrics_tools/video_output.py", line 15, in 
exec(compile(fh.read(), python_script, 'exec'), context)
File "/home/whill/catkin_ws/src/nav_metrics_tools/scripts/video_output.py", line 13, in 
profile = pipeline.start(config)
RuntimeError: No device connected
Below is the content of video_output.py.
import pyrealsense2 as rs
import numpy as np
import cv2
import time
Configure depth and color streams
config = rs.config()
config.enable_stream(rs.stream.infrared, 1, 640, 480, rs.format.y8, 30)
config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
config.enable_stream(rs.stream.color, 640, 480, rs.format.bgr8, 30)
config.enable_record_to_file('../video/d435data.bag')
Start streaming
pipeline = rs.pipeline()
pipeline.start(config)
start = time.time()
frame_no = 1
try:
while True:
# Wait for a coherent pair of frames: depth and color
frames = pipeline.wait_for_frames()
color_frame = frames.get_color_frame()
ir_frame = frames.get_infrared_frame()
fps  = frame_no / (time.time() - start)
print(fps)
frame_no = frame_no+1
if not ir_frame or not color_frame  :
ir_image = np.asanyarray(ir_frame .get_data())
color_image = np.asanyarray(color_frame.get_data())
finally:
pipeline.stop()
It doesn't seem to be a problem with USB recognition, so I think there may have been a problem with the way librealsense was downloaded, installed, or built.
~/catkin_ws/src/librealsense/scripts$ lsusb
Bus 004 Device 002: ID 8086:0b07 Intel Corp. Intel(R) RealSense(TM) Depth Camera 435
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 04f2:b704 Chicony Electronics Co., Ltd FJ Camera
Bus 003 Device 002: ID 06cb:00f3 Synaptics, Inc.
Bus 003 Device 004: ID 8087:0026 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
~/catkin_ws/src/librealsense/scripts$ modinfo uvcvideo | grep "version:"
version:        1.1.1-realsense-1.3.27
srcversion:     A5F8CFCB90CF528ABE09084
The control transferred returned error is not persistent, so I think it's probably okay to ignore it.
~$ roslaunch realsense2_camera rs_camera.launch
... logging to /home/whill/.ros/log/277c3704-afc5-11f0-96dc-b367be3c40d6/roslaunch-whill-FMVUXF3B-146412.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://whill-FMVUXF3B:39925/
SUMMARY
PARAMETERS
- /camera/realsense2_camera/accel_fps: -1
- /camera/realsense2_camera/accel_frame_id: camera_accel_frame
- /camera/realsense2_camera/accel_optical_frame_id: camera_accel_opti...
- /camera/realsense2_camera/align_depth: False
- /camera/realsense2_camera/aligned_depth_to_color_frame_id: camera_aligned_de...
- /camera/realsense2_camera/aligned_depth_to_fisheye1_frame_id: camera_aligned_de...
- /camera/realsense2_camera/aligned_depth_to_fisheye2_frame_id: camera_aligned_de...
- /camera/realsense2_camera/aligned_depth_to_fisheye_frame_id: camera_aligned_de...
- /camera/realsense2_camera/aligned_depth_to_infra1_frame_id: camera_aligned_de...
- /camera/realsense2_camera/aligned_depth_to_infra2_frame_id: camera_aligned_de...
- /camera/realsense2_camera/allow_no_texture_points: False
- /camera/realsense2_camera/base_frame_id: camera_link
- /camera/realsense2_camera/calib_odom_file:
- /camera/realsense2_camera/clip_distance: -2.0
- /camera/realsense2_camera/color_fps: -1
- /camera/realsense2_camera/color_frame_id: camera_color_frame
- /camera/realsense2_camera/color_height: -1
- /camera/realsense2_camera/color_optical_frame_id: camera_color_opti...
- /camera/realsense2_camera/color_width: -1
- /camera/realsense2_camera/confidence_fps: -1
- /camera/realsense2_camera/confidence_height: -1
- /camera/realsense2_camera/confidence_width: -1
- /camera/realsense2_camera/depth_fps: -1
- /camera/realsense2_camera/depth_frame_id: camera_depth_frame
- /camera/realsense2_camera/depth_height: -1
- /camera/realsense2_camera/depth_optical_frame_id: camera_depth_opti...
- /camera/realsense2_camera/depth_width: -1
- /camera/realsense2_camera/device_type:
- /camera/realsense2_camera/enable_accel: False
- /camera/realsense2_camera/enable_color: True
- /camera/realsense2_camera/enable_confidence: True
- /camera/realsense2_camera/enable_depth: True
- /camera/realsense2_camera/enable_fisheye1: False
- /camera/realsense2_camera/enable_fisheye2: False
- /camera/realsense2_camera/enable_fisheye: False
- /camera/realsense2_camera/enable_gyro: False
- /camera/realsense2_camera/enable_infra1: False
- /camera/realsense2_camera/enable_infra2: False
- /camera/realsense2_camera/enable_infra: False
- /camera/realsense2_camera/enable_pointcloud: False
- /camera/realsense2_camera/enable_pose: False
- /camera/realsense2_camera/enable_sync: False
- /camera/realsense2_camera/filters:
- /camera/realsense2_camera/fisheye1_frame_id: camera_fisheye1_f...
- /camera/realsense2_camera/fisheye1_optical_frame_id: camera_fisheye1_o...
- /camera/realsense2_camera/fisheye2_frame_id: camera_fisheye2_f...
- /camera/realsense2_camera/fisheye2_optical_frame_id: camera_fisheye2_o...
- /camera/realsense2_camera/fisheye_fps: -1
- /camera/realsense2_camera/fisheye_frame_id: camera_fisheye_frame
- /camera/realsense2_camera/fisheye_height: -1
- /camera/realsense2_camera/fisheye_optical_frame_id: camera_fisheye_op...
- /camera/realsense2_camera/fisheye_width: -1
- /camera/realsense2_camera/gyro_fps: -1
- /camera/realsense2_camera/gyro_frame_id: camera_gyro_frame
- /camera/realsense2_camera/gyro_optical_frame_id: camera_gyro_optic...
- /camera/realsense2_camera/imu_optical_frame_id: camera_imu_optica...
- /camera/realsense2_camera/infra1_frame_id: camera_infra1_frame
- /camera/realsense2_camera/infra1_optical_frame_id: camera_infra1_opt...
- /camera/realsense2_camera/infra2_frame_id: camera_infra2_frame
- /camera/realsense2_camera/infra2_optical_frame_id: camera_infra2_opt...
- /camera/realsense2_camera/infra_fps: 30
- /camera/realsense2_camera/infra_height: 480
- /camera/realsense2_camera/infra_rgb: False
- /camera/realsense2_camera/infra_width: 848
- /camera/realsense2_camera/initial_reset: False
- /camera/realsense2_camera/json_file_path:
- /camera/realsense2_camera/linear_accel_cov: 0.01
- /camera/realsense2_camera/odom_frame_id: camera_odom_frame
- /camera/realsense2_camera/ordered_pc: False
- /camera/realsense2_camera/pointcloud_texture_index: 0
- /camera/realsense2_camera/pointcloud_texture_stream: RS2_STREAM_COLOR
- /camera/realsense2_camera/pose_frame_id: camera_pose_frame
- /camera/realsense2_camera/pose_optical_frame_id: camera_pose_optic...
- /camera/realsense2_camera/publish_odom_tf: True
- /camera/realsense2_camera/publish_tf: True
- /camera/realsense2_camera/reconnect_timeout: 6.0
- /camera/realsense2_camera/rosbag_filename:
- /camera/realsense2_camera/serial_no:
- /camera/realsense2_camera/stereo_module/exposure/1: 7500
- /camera/realsense2_camera/stereo_module/exposure/2: 1
- /camera/realsense2_camera/stereo_module/gain/1: 16
- /camera/realsense2_camera/stereo_module/gain/2: 16
- /camera/realsense2_camera/tf_publish_rate: 0.0
- /camera/realsense2_camera/topic_odom_in: odom_in
- /camera/realsense2_camera/unite_imu_method:
- /camera/realsense2_camera/usb_port_id:
- /camera/realsense2_camera/wait_for_device_timeout: -1.0
- /rosdistro: noetic
- /rosversion: 1.17.0
NODES
/camera/
realsense2_camera (nodelet/nodelet)
realsense2_camera_manager (nodelet/nodelet)
ROS_MASTER_URI=http://localhost:11311
process[camera/realsense2_camera_manager-1]: started with pid [146433]
process[camera/realsense2_camera-2]: started with pid [146434]
[ INFO] [1761193683.496236269]: Initializing nodelet with 8 worker threads.
[ INFO] [1761193683.593209736]: RealSense ROS v2.3.2
[ INFO] [1761193683.593243477]: Built with LibRealSense v2.50.0
[ INFO] [1761193683.593261162]: Running with LibRealSense v2.50.0
[ INFO] [1761193683.617316514]:
[ INFO] [1761193683.641274449]: Device with serial number 135122079343 was found.
[ INFO] [1761193683.641316588]: Device with physical ID 4-1-2 was found.
[ INFO] [1761193683.641337426]: Device with name Intel RealSense D435 was found.
[ INFO] [1761193683.641721972]: Device with port number 4-1 was found.
[ INFO] [1761193683.641747372]: Device USB type: 3.2
[ INFO] [1761193683.642740631]: getParameters...
[ INFO] [1761193683.662940495]: setupDevice...
[ INFO] [1761193683.662958408]: JSON file is not provided
[ INFO] [1761193683.662968017]: ROS Node Namespace: camera
[ INFO] [1761193683.662977451]: Device Name: Intel RealSense D435
[ INFO] [1761193683.662985243]: Device Serial No: 135122079343
[ INFO] [1761193683.662993147]: Device physical port: 4-1-2
[ INFO] [1761193683.663000606]: Device FW version: 05.17.00.10
[ INFO] [1761193683.663008131]: Device Product ID: 0x0B07
[ INFO] [1761193683.663016335]: Enable PointCloud: Off
[ INFO] [1761193683.663026458]: Align Depth: Off
[ INFO] [1761193683.663033683]: Sync Mode: Off
[ INFO] [1761193683.663058265]: Device Sensors:
[ INFO] [1761193683.676597634]: Stereo Module was found.
[ INFO] [1761193683.681826599]: RGB Camera was found.
[ INFO] [1761193683.681855828]: (Confidence, 0) sensor isn't supported by current device! -- Skipping...
[ INFO] [1761193683.681873826]: num_filters: 0
[ INFO] [1761193683.681884095]: Setting Dynamic reconfig parameters.
hwmon command 0x80( 5 0 0 0 ) failed (response -7= HW not ready)
hwmon command 0x80( 5 0 0 0 ) failed (response -7= HW not ready)
hwmon command 0x80( 5 0 0 0 ) failed (response -7= HW not ready)
hwmon command 0x80( 5 0 0 0 ) failed (response -7= HW not ready)
[ INFO] [1761193684.111895142]: Done Setting Dynamic reconfig parameters.
[ INFO] [1761193684.112240430]: depth stream is enabled - width: 848, height: 480, fps: 30, Format: Z16
[ INFO] [1761193684.112539057]: color stream is enabled - width: 640, height: 480, fps: 30, Format: RGB8
[ INFO] [1761193684.112554309]: setupPublishers...
[ INFO] [1761193684.113750314]: Expected frequency for depth = 30.00000
[ INFO] [1761193684.127974496]: Expected frequency for color = 30.00000
[ INFO] [1761193684.137108879]: setupStreams...
23/10 13:28:04,174 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
[ INFO] [1761193684.225124482]: SELECTED BASE:Depth, 0
[ INFO] [1761193684.241812156]: RealSense Node Is Up!
[ WARN] [1761193684.293556315]:
23/10 13:28:04,294 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
23/10 13:28:04,344 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
23/10 13:28:04,496 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
23/10 13:28:04,621 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
23/10 13:28:04,672 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
23/10 13:28:04,824 WARNING [139640402368256] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11
As shown in the attached photo, when I start realsense-viewer, under Add Sources on the left side of the photo, it just says Connect a RealSense Camera or Add Source, but no information about the realsense d435 is displayed.
I feel like the problem of the No device connected and the problem of the image not being displayed on realsense-viewer are somehow related.
Before installing the librealsense related packages, the image was displayed properly in realsense-viewer.
Below are the steps I took to install, download, and build librealsense from start to finish, but I'm not sure if this is the right procedure:
First, I referred to the following page:https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md#installing-the-packages
~/catkin_ws/src/$ sudo mkdir -p /etc/apt/keyrings
~/catkin_ws/src/$ curl -sSf https://librealsense.intel.com/Debian/librealsense.pgp | sudo tee /etc/apt/keyrings/librealsense.pgp > /dev/null
~/catkin_ws/src/$ echo "deb [signed-by=/etc/apt/keyrings/librealsense.pgp] https://librealsense.intel.com/Debian/apt-repo lsb_release -cs main" | 
~/catkin_ws/src/$ sudo tee /etc/apt/sources.list.d/librealsense.list
~/catkin_ws/src/$ sudo apt-get update
~/catkin_ws/src/$ sudo apt-get install librealsense2-dkms
~/catkin_ws/src/$ sudo apt-get install librealsense2-utils
~/catkin_ws/src/$ sudo apt-get install librealsense2-dev
~/catkin_ws/src/$ sudo apt-get install librealsense2-dbg
~/catkin_ws/src/$ sudo apt-get update
~/catkin_ws/src/$ sudo apt-get upgrade
~/catkin_ws/src/$ pip3 install pyrealsense2
~/catkin_ws/src/$ sudo apt-get update && sudo apt-get upgrade
~/catkin_ws/src/$ sudo apt-get install python3 python3-dev
~/catkin_ws/src/$ git clone https://github.com/IntelRealSense/librealsense.git
~/catkin_ws/src/$ cd librealsense
~/catkin_ws/src/librealsense/$ mkdir build
~/catkin_ws/src/librealsense/$ cd build
~/catkin_ws/src/librealsense/build/$ cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=$(which python3)
~/catkin_ws/src/librealsense/build/$ make -j4
~/catkin_ws/src/librealsense/build/$ sudo make install
~/catkin_ws/src/librealsense/build/$ export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.8/dist-packages/pyrealsense2
As shown in the picture, export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python3.8/dist-packages/pyrealsense2 is written at the bottom of ~/.bashrc.
I have three concerns.
First, after I ran cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=$(which python3) in the ~/catkin_ws/src/librealsense/ directory, I accidentally ran make -j4 and catkin_make install in the ~/catkin_ws/src/librealsense/ directory. Immediately afterwards, I ran make -j4 and catkin_make install again in the ~/catkin_ws/src/librealsense/build directory, and both succeeded without errors.
Second, I ran cmake ../ -DBUILD_PYTHON_BINDINGS:bool=true -DPYTHON_EXECUTABLE=$(which python3) -D-DFORCE_LIBUVC=true in the ~/catkin_ws/src/librealsense/build directory. This did not work to improve the error in video_output.py, so I changed it to DFORCE_LIBUVC=false and ran cmake again, which was successful.
Third, as I was installing, downloading, and building librealsense, a screen that looked like secure boot appeared.
I want to run video_output.py to record video from my realsense d435!!
I would appreciate some guidance. Thank you in advance.
 
