IntelRealSense / realsense-ros

ROS Wrapper for Intel(R) RealSense(TM) Cameras
http://wiki.ros.org/RealSense
Apache License 2.0
2.51k stars 1.74k forks source link

Can't execute "ros2 run realsense2_camera realsense2_camera_node" #3158

Closed drinkBr closed 2 weeks ago

drinkBr commented 2 months ago
Required Info
Camera Model D435
Firmware Version 5.13.0.55
Operating System & Version Ubuntu22.04
Platform Raspberry Pi4 model B
Librealsense SDK Version 2.55.1 (realsense-viewer Version)
Segment Robot
ROS Distro Humble

Issue Description

I encountered the following error when executing ros2 run realsense2_camera realsense2_camera_node.

[INFO] [1720575182.089151480] [camera.camera]: Device FW version: 5.13.0.55
[INFO] [1720575182.089356979] [camera.camera]: Device Product ID: 0x0B07
[INFO] [1720575182.089552885] [camera.camera]: Sync Mode: Off
[WARN] [1720575182.304168366] [camera.camera]: Could not set param: rgb_camera.power_line_frequency with 3 Range: [0, 2]: parameter 'rgb_camera.power_line_frequency' could not be set: Parameter {rgb_camera.power_line_frequency} doesn't comply with integer range.
[INFO] [1720575182.380895995] [camera.camera]: Stopping Sensor: Depth Module
[INFO] [1720575182.382941983] [camera.camera]: Stopping Sensor: RGB Camera
[INFO] [1720575182.460460718] [camera.camera]: Starting Sensor: Depth Module
[INFO] [1720575182.503783789] [camera.camera]: Open profile: stream_type: Infra(1), Format: Y8, Width: 848, Height: 480, FPS: 30
[INFO] [1720575182.504291397] [camera.camera]: Open profile: stream_type: Infra(2), Format: Y8, Width: 848, Height: 480, FPS: 30
[INFO] [1720575182.504599488] [camera.camera]: Open profile: stream_type: Depth(0), Format: Z16, Width: 848, Height: 480, FPS: 30
[WARN] [1720575182.611571490] [camera.camera]: frame's time domain is HARDWARE_CLOCK. Timestamps may reset periodically.
 10/07 10:33:07,728 ERROR [281473139402976] (librealsense-exception.h:52) get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Connection timed out
 10/07 10:33:07,729 ERROR [281473139402976] (global_timestamp_reader.cpp:239) Error during time_diff_keeper polling: get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Connection timed out
 10/07 10:33:12,848 ERROR [281473114040544] (librealsense-exception.h:52) get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: No such file or directory
 10/07 10:33:12,848 ERROR [281473114040544] (error-handling.cpp:99) Error during polling error handler: get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: No such file or directory
 10/07 10:33:17,972 ERROR [281473147857120] (librealsense-exception.h:52) set_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Connection timed out
 10/07 10:33:17,973 ERROR [281473147857120] (rs.cpp:237) [rs2_get_video_stream_intrinsics( from:0xffff8805c040, intr:[ -1471343544x65535  p[-1.60068e-27 9.18341e-41]  f[-1.60092e-27 9.18341e-41]  UNKNOWN [9.18341e-41 -1.60094e-27 9.18341e-41 -4.06313e-34 9.18341e-41] ] ) Backend] set_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Connection timed out
[WARN] [1720575197.973901736] [camera.camera]: No intrinsics available for this stream profile. Using zeroed intrinsics as default.
[ERROR] [1720575208.213363266] [camera.camera]: /home/agri/ros2_ws/src/realsense-ros/realsense2_camera/src/rs_node_setup.cpp:487:An exception has been thrown: std::exception
[ERROR] [1720575208.213606135] [camera.camera]: /home/agri/ros2_ws/src/realsense-ros/realsense2_camera/src/rs_node_setup.cpp:369:An exception has been thrown: std::exception
[ERROR] [1720575208.213811041] [camera.camera]: Error starting device: std::exception

I believe that it is necessary to set the value of rgb_camera.power_line_frequency, but I would like to hear your opinion. Also, after this error was displayed, I executed realsense-viewer, and when I turned on the Stereo Module, the following error appeared. I confirmed that the same error message appeared when executing ros2 run realsense2_camera realsense2_camera_node, so I believe they are related. I would like to hear your opinion.

Backend in rs2_open_multiple(sensor:0xffffa0016110, profiles:0xffffa0162bc0,
count:1):
set_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: Connection timed out
MartyG-RealSense commented 1 month ago

Thanks very much, @drinkBr

MiTomMi commented 1 month ago

Hi @MartyG-RealSense, I tried 2 methods:

Method 1: ros2 launch realsense2_camera rs_launch.py depth_module.depth_profile:=640x480x15 rgb_camera.color_profile:=640x480x15 global_time_enabled:=false enable_sync:=true

Method 2: ros2 launch realsense2_camera rs_launch.py inital_reset:=true global_time_enabled:=false enable_sync:=true

Both methods result in these 4 major errors as in this issue:

[realsense2_camera_node-1] 12/08 14:55:27,553 ERROR [281472736749792] (librealsense-exception.h:52) get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: No such file or directory [realsense2_camera_node-1] 12/08 14:55:27,554 ERROR [281472736749792] (error-handling.cpp:99) Error during polling error handler: get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: No such file or directory [realsense2_camera_node-1] [ERROR] [1723449342.915113340] [camera.camera]: ./src/rs_node_setup.cpp:487:An exception has been thrown: std::exception [realsense2_camera_node-1] [ERROR] [1723449342.915517448] [camera.camera]: ./src/rs_node_setup.cpp:369:An exception has been thrown: std::exception [realsense2_camera_node-1] [ERROR] [1723449342.916101758] [camera.camera]: Error starting device: std::exception

Could you explain what are those errors and what cause them? I have tried to debug them with many methods from github but I still get the same error.

I'm looking forward to your reply. Thanks a lot!

MartyG-RealSense commented 1 month ago

@MiTomMi It looks as though the error get_xu(...). xioctl(UVCIOC_CTRL_QUERY) failed Last Error: No such file or directory nearly always occurs on Raspberry Pi boards. None of the four Pi cases linked to below that experience the errors offer a solution, unfortunately. There is not a defined meaning available for these errors.

https://github.com/IntelRealSense/realsense-ros/issues/2991 https://github.com/IntelRealSense/realsense-ros/issues/3089 https://forums.raspberrypi.com/viewtopic.php?t=370620 https://www.reddit.com/r/ROS/comments/1cp30d4/problem_getting_rgb_frames_via_intelrealsense/

There were a couple of non-Pi cases of the error where updating the camera firmware driver resolved it.

drinkBr commented 1 month ago

Hi, @MartyG-RealSense Sorry for the late reply. I forgot that I haven't installed realsense-ros on the Ubuntu system on the SSD yet, so I haven't been able to verify it. Since I'm at it, I would like to confirm the installation steps for realsense-ros.

When I previously installed realsense-ros, I followed the instructions on the following page. Is that correct? Are there any necessary changes to consider if I installed realsense-related components using the LibUVC-backend installation method?

Installation on Ubuntu Step3 Option2 : https://github.com/IntelRealSense/realsense-ros

MartyG-RealSense commented 1 month ago

If you install librealsense from source code using the libuvc backend method then you can then afterwards build the ROS2 wrapper from source code with colcon build. In other words, use Step 3 Option 2 as you said.

You are using a Raspberry Pi 4 though, so there might be complications. Please give a colcon build a try and see what happens. You can always remove the wrapper build easily afterwards without affecting your librealsense installation if the wrapper does not work correctly.

drinkBr commented 1 month ago

Hi, @MartyG-RealSense

You are using a Raspberry Pi 4 though, so there might be complications. Please give a colcon build a try and see what happens.

Is it correct that I should verify the colcon build before installing realsense-ros?

MartyG-RealSense commented 1 month ago

The recommended install order in the instructions is:

  1. ROS (e.g ROS2 Humble)
  2. librealsense
  3. ROS wrapper

Skip step 1 if Humble is already installed.

I am not certain what you mean regarding verifying colcon build before installing realsense-ros, as colcon build is what does install realsense-ros.

drinkBr commented 1 month ago

I misunderstood. So, I just need to execute Step 3 Option 2 in the Terminal, right?

MartyG-RealSense commented 1 month ago

Yes, that's correct.

drinkBr commented 1 month ago

OK! I will test it tomorrow and send you a message.

haidaumitom commented 4 weeks ago

Hi @MartyG-RealSense, I am MiTomMi. I have tried to re-install Ubuntu desktop 22.04 LTS and ROS2 Humble on Raspberry Pi 4. I followed libuvc_installation.md. After finished installing it, I ran the command: realsense-viewer and it was only successful whenever I re-plug in the cable. The results are shown below:

Screenshot from 2024-08-15 18-33-27 Screenshot from 2024-08-15 18-38-00

I don't know why the frames are fractured like this. Could you figure it out?

Thanks a lot!!!

haidaumitom commented 4 weeks ago

UPDATE: Hi @MartyG-RealSense. I ran rs-capture and the result are really clear with no problem.

Screenshot from 2024-08-15 18-52-24

Do you know what's the problem in realsense-viewer in my case?

Thank you!!!

MartyG-RealSense commented 4 weeks ago

The rs-capture image is a 2D depth image like the one in the RealSense Viewer when you select the '2D' option in the top corner of the Viewer window. The broken images that you provided above are from the '3D' pointcloud mode of the Viewer.

Do you get a better depth image in the Viewer if you click on '2D' to switch to 2D depth mode?

I note that in your Viewer's 3D mode with the broken images, the 'Measure' option at the top of the window is greyed out and unselectable. This suggests that the GLSL graphics options in your Viewer are disabled. You can use instructions at https://github.com/IntelRealSense/librealsense/issues/8110#issuecomment-754705023 to check the status of the GLSL options and see whether they are currently enabled or disabled.

If the boxes beside the Processing and Rendering settings are black (off) then try clicking on them to turn the boxes blue (on) and click the Apply button, then test the depth pointcloud in 3D mode again.

MartyG-RealSense commented 3 weeks ago

Hi @drinkBr and @haidaumitom Do either of you require further assistance with this case, please? Thanks!

haidaumitom commented 3 weeks ago

Hi @MartyG-RealSense, I do not require any addition assistance.

Thanks for your really supporting help! I really appreciate that!

Best regards.

MartyG-RealSense commented 3 weeks ago

@haidaumitom Thanks very much. You are very welcome. I'm pleased that I could help!

@drinkBr Is your problem resolved, please?

MartyG-RealSense commented 2 weeks ago

Case closed due to no further comments received.