IntelRealSense / librealsense

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

"Error: No RealSense device." when calibrating IMU on Orange Pi 5 Plus #12906

Open MingyuPan2 opened 1 month ago

MingyuPan2 commented 1 month ago
Required Info
Camera Model D435i
Firmware Version 5.15.1
Operating System & Version Ubuntu 22.04.4 LTS
Kernel Version (Linux Only) 5.10.160-rockchip
Platform Orange Pi 5 Plus
SDK Version Intel RealSense Viewer v2.55.1
Language python 3.10.12

Issue Description

Hi, I am trying to calibrate the IMU in the D435i using the given code in /librealsense/tools/rs-imu-calibration.

Command: python3 rs-imu-calibration.py,

Output: waiting for realsense device...

Error: No RealSense device. Traceback (most recent call last): File "/home/mingyupan/Documents/D435i/librealsense/tools/rs-imu-calibration/rs-imu-calibration.py", line 732, in main() File "/home/mingyupan/Documents/D435i/librealsense/tools/rs-imu-calibration/rs-imu-calibration.py", line 721, in main if os.name == 'posix' and old_settings is not None: UnboundLocalError: local variable 'old_settings' referenced before assignment

It seems that the "serial_no" was not recognized at all when the code was ran. However, in the realsense-viewer, I can view the IMU data perfectly normal, even with Stereo Module with Infrared 1,2 and RGB camera enabled all at the same time. What might be the issue?

MingyuPan2 commented 1 month ago

Screenshot from 2024-05-07 16-28-11 Here's what i see in my realsense viewer

MartyG-RealSense commented 1 month ago

Hi @MingyuPan2 This error with rs-imu-calibration.py has not been previously reported.

Can you confirm that the RealSense Viewer is closed when you launch the calibration script, please?

Some years ago the calibration script used to be important because an IMU calibration needed to be written to the camera hardware before an Enable Motion Correction option in 'Motion Module > Controls' would unlock. This option 'fixes' raw IMU data to make it more accurate. However, the motion correction option is now usually unlocked and enabled by default on IMU-equipped RealSense camera models, making the calibration script less important now.

image

MingyuPan2 commented 1 month ago

Thank you for the reply @MartyG-RealSense! Yes, the Viewer is closed when the script was launched. How much more accurate will the IMU be if i calibrate it? For now, my normal is about 9.74 for Mounting screw pointing down, device facing out.

I also do not have the Gyro Sensitivity option in my viewer but can access everything else. Screenshot from 2024-05-08 10-42-22

Can this be a hardware compatibility issue? I just don't understand why the Viewer works fine but the script won't.

MartyG-RealSense commented 1 month ago

The ideal target value is 9.80, so 9.74 is a very good current calibration and you likely do not currently need to perform a calibration of the IMU.

The new variable gyro sensitivity feature requires SDK 2.55.1 and firmware 5.16.0.1.

image

Sometimes the IMU calibration script does have problems for unknown reasons and there is not a workaround or solution for it. As your camera's IMU works fine with the Viewer, it is likely a software problem (SDK, kernel, etc) rather than a hardware one.

When using RealSense cameras with a computing device that has a Rockchip (RK) chipset, it is recommendable to build the RealSense SDK from source code with the RSUSB backend installation method (-DFORCE_RSUSB_BACKEND=TRUE).

MingyuPan2 commented 1 month ago

Thank you! I will try the RSUSB backend method tomorrow.

I also installed ROS2 Iron and the ROS2 wrapper today based on the official instructions. The build process did not give any errors, but when i try ros2 run realsense2_camera realsense2_camera_node, or ros2 launch realsense2_camera rs_launch.py, I get the error: [INFO] [1715197483.388950003] [camera.camera]: RealSense ROS v4.54.1 [INFO] [1715197483.389225624] [camera.camera]: Built with LibRealSense v2.54.1 [INFO] [1715197483.389279582] [camera.camera]: Running with LibRealSense v2.54.1 08/05 15:44:43,414 WARNING [281472409657728] (d400-factory.cpp:1195) DS5 group_devices is empty. [WARN] [1715197483.414158992] [camera.camera]: No RealSense devices were found!

Since my kernel version is 5.10.160-rockchip, is this another software compatibility issue because of the kernel version?

MartyG-RealSense commented 1 month ago

It could be because it is currently a non-RSUSB installation of librealsense, yes.

You could try performing a reset of the camera at launch with ros2 launch or ros2 run to see whether that makes a difference.

ROS2 RUN ros2 run realsense2_camera realsense2_camera_node --ros-args -p initial_reset:=true

ROS2 LAUNCH ros2 launch realsense2_camera rs_launch.py initial_reset:=true

MingyuPan2 commented 1 month ago

HI @MartyG-RealSense , I reinstalled and rebuilt everything with all the methods provided above (RSUSB,reset camera at launch), but the scripts still give the same error that No Realsense devices were found. Do you have any other idea of what the problem may be? Thank you!

MartyG-RealSense commented 1 month ago

The error message in your opening comment in this discussion indicates that there is a problem with the old_settings instruction in lines 721 and 722 of the rs-imu-calibration script. What happens if you comment out these two lines and then run the script, please?

MingyuPan2 commented 1 month ago

I tried it a few days before. It just gives the same error without the Traceback (...):

waiting for realsense device...

Error: No RealSense device.

MartyG-RealSense commented 1 month ago

You already have a very good calibration of 9.74 against an ideal of 9.80. That value is not likely to degrade over time. So at this point I would recommend putting the calibration attempts on hold, because what you already have is fine.

MingyuPan2 commented 1 month ago

For now, i am able to use the command (ros2 launch realsense2_camera rs_launch.py) to get the following output:

[INFO] [launch]: All log files can be found below /home/mingyupan/.ros/log/2024-05-10-14-49-38-865772-MP-Orange5P-23393 [INFO] [launch]: Default logging verbosity is set to INFO [INFO] [realsense2_camera_node-1]: process started with pid [23397] [realsense2_camera_node-1] [INFO] [1715366979.087106620] [camera.camera]: RealSense ROS v4.54.1 [realsense2_camera_node-1] [INFO] [1715366979.087244285] [camera.camera]: Built with LibRealSense v2.55.1 [realsense2_camera_node-1] [INFO] [1715366979.087264993] [camera.camera]: Running with LibRealSense v2.55.1 [realsense2_camera_node-1] [INFO] [1715366979.803848454] [camera.camera]: Device with serial number 238222074578 was found. [realsense2_camera_node-1] [realsense2_camera_node-1] [INFO] [1715366979.804017620] [camera.camera]: Device with physical ID 6-1.4-8 was found. [realsense2_camera_node-1] [INFO] [1715366979.804040661] [camera.camera]: Device with name Intel RealSense D435I was found. [realsense2_camera_node-1] [INFO] [1715366979.804397366] [camera.camera]: Device with port number 6-1.4 was found. [realsense2_camera_node-1] [INFO] [1715366979.804430324] [camera.camera]: Device USB type: 3.2

[realsense2_camera_node-1] [INFO] [1715366979.805031152] [camera.camera]: JSON file is not provided [realsense2_camera_node-1] [INFO] [1715366979.805075777] [camera.camera]: Device Name: Intel RealSense D435I [realsense2_camera_node-1] [INFO] [1715366979.805097943] [camera.camera]: Device Serial No: 238222074578 [realsense2_camera_node-1] [INFO] [1715366979.805119527] [camera.camera]: Device physical port: 6-1.4-8 [realsense2_camera_node-1] [INFO] [1715366979.805137026] [camera.camera]: Device FW version: 5.15.1 [realsense2_camera_node-1] [INFO] [1715366979.805155985] [camera.camera]: Device Product ID: 0x0B3A [realsense2_camera_node-1] [INFO] [1715366979.805176401] [camera.camera]: Sync Mode: Off [realsense2_camera_node-1] [INFO] [1715366983.242201843] [camera.camera]: Set ROS param depth_module.depth_profile to default: 848x480x30 [realsense2_camera_node-1] [INFO] [1715366983.243412249] [camera.camera]: Set ROS param depth_module.infra_profile to default: 848x480x30 [realsense2_camera_node-1] [INFO] [1715366983.413298726] [camera.camera]: Set ROS param rgb_camera.color_profile to default: 1280x720x30 [realsense2_camera_node-1] [INFO] [1715366983.416449865] [camera.camera]: Set ROS param gyro_fps to default: 200 [realsense2_camera_node-1] [INFO] [1715366983.416934902] [camera.camera]: Set ROS param accel_fps to default: 100 [realsense2_camera_node-1] [INFO] [1715366983.427021814] [camera.camera]: Stopping Sensor: Depth Module [realsense2_camera_node-1] [INFO] [1715366983.427349936] [camera.camera]: Stopping Sensor: RGB Camera [realsense2_camera_node-1] [INFO] [1715366983.555959814] [camera.camera]: Starting Sensor: Depth Module [realsense2_camera_node-1] [INFO] [1715366983.661109105] [camera.camera]: Open profile: stream_type: Depth(0), Format: Z16, Width: 848, Height: 480, FPS: 30 [realsense2_camera_node-1] 10/05 14:49:43,661 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] [INFO] [1715366983.664502618] [camera.camera]: Starting Sensor: RGB Camera [realsense2_camera_node-1] 10/05 14:49:43,672 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] [INFO] [1715366983.694871561] [camera.camera]: Open profile: stream_type: Color(0), Format: RGB8, Width: 1280, Height: 720, FPS: 30 [realsense2_camera_node-1] [INFO] [1715366983.699756352] [camera.camera]: RealSense Node Is Up! [realsense2_camera_node-1] 10/05 14:49:43,891 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:43,901 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,012 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,023 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,034 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,050 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,061 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,072 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,286 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,296 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,307 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0 [realsense2_camera_node-1] 10/05 14:49:44,318 WARNING [281472652730752] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Success, number: 0

I am currently looking up why it is giving the warnings.

MartyG-RealSense commented 1 month ago

I note that you are using librealsense 2.55.1. The 2.54.2 version of librealsense should be used with wrapper 4.54.1. There is not a ROS wrapper for 2.55.1 at the time of writing this.

The control_transfer returned warning indicates that there may be a communication problem between the camera and computer, likely related to the USB system (the port or the cable).

Sometimes streams are able to be published successfully in RViz even if these warnings are generating in the log continuously, so please check RViz to see if the streams are displayed.

MingyuPan2 commented 1 month ago

Hi @MartyG-RealSense , thank you for the information! Yes, i can see the streams in RViz such as pointcloud, depth, rgb, infra&2. And the terminal still sometimes output errors such as:

[WARN] [1715886051.829293254] [camera.camera]: No stream match for pointcloud chosen texture Process - Color [realsense2_camera_node-1] 16/05 15:00:08,336 WARNING [281472317186432] (messenger-libusb.cpp:42) control_transfer returned error, index: 768, error: Resource temporarily unavailable, number: 11.


Interestingly, whenever I try (rs-enumerate-devices), it always gives the following output:

16/05 15:05:43,107 ERROR [281473402728576] (handle-libusb.h:125) failed to claim usb interface: 0, error: RS2_USB_STATUS_BUSY 16/05 15:05:43,107 ERROR [281473446666304] (uvc-sensor.cpp:412) acquire_power failed: failed to set power state 16/05 15:05:43,107 ERROR [281473446666304] (rs.cpp:237) [rs2_create_device( info_list:0xaaaac1441d30, index:0 ) UNKNOWN] failed to set power state 16/05 15:05:43,107 ERROR [281473446666304] (rs.cpp:237) [rs2_delete_device( device:nullptr ) UNKNOWN] null pointer passed for argument "device" Could not create device - failed to set power state . Check SDK logs for details No device detected. Is it plugged in?


I'm still in the process of testing the camera's functionalities, so are the errors something i should fix immediately or can i ignore them as long as RViz's output is normal? Thank you!

MartyG-RealSense commented 1 month ago

As long as RViz's output is normal then it is usually safe to ignore log warnings.