realsense-ros icon indicating copy to clipboard operation
realsense-ros copied to clipboard

ROS2-beta: RGB and depth FPS is lower than configured

Open guoqingzh opened this issue 2 years ago • 10 comments

launch ROS2 realsense node and echo rgb/depth topic with ros2 topic hz. The report FPS is much lower than configurated FPS

guoqingzh avatar Oct 13 '22 11:10 guoqingzh

Hi @guoqingzh If you are launching in ros2_beta with rs_launch.py, do you get improved FPS if you launch with ros2 run

ros2 run realsense2_camera realsense2_camera_node

MartyG-RealSense avatar Oct 13 '22 12:10 MartyG-RealSense

Hi @guoqingzh If you are launching in ros2_beta with rs_launch.py, do you get improved FPS if you launch with ros2 run

ros2 run realsense2_camera realsense2_camera_node

this is the command I used:

ros2 launch realsense2_camera rs_launch.py camera_name:='camera2' serial_no:="'_xxxxxxxxx'" rgb_camera.profile :='1280,720,30'

guoqingzh avatar Oct 13 '22 12:10 guoqingzh

What is the actual FPS that is being reported?

Also, can you confirm whether the camera is being detected as being on a USB 3 connection. If it was being detected as USB 2.1 (either because the connection was mis-detected or the camera is plugged into a USB 2 port / attached to a USB 2 cable) then the only FPS speed supported for 1280x720 resolution in USB 2.1 mode would be 6 FPS (5 on the RealSense D455 camera model).

MartyG-RealSense avatar Oct 13 '22 12:10 MartyG-RealSense

What is the actual FPS that is being reported?

Also, can you confirm whether the camera is being detected as being on a USB 3 connection. If it was being detected as USB 2.1 (either because the connection was mis-detected or the camera is plugged into a USB 2 port / attached to a USB 2 cable) then the only FPS speed supported for 1280x720 resolution in USB 2.1 mode would be 6 FPS (5 on the RealSense D455 camera model).

It is USB3. The reported FPG is ~ 23 FPS when configured 30 FPS.

guoqingzh avatar Oct 13 '22 12:10 guoqingzh

Thank you. And what is the FPS for color when launching with ros2 run realsense2_camera realsense2_camera_node

MartyG-RealSense avatar Oct 13 '22 12:10 MartyG-RealSense

Thank you. And what is the FPS for color when launching with ros2 run realsense2_camera realsense2_camera_node

it is the same

guoqingzh avatar Oct 13 '22 12:10 guoqingzh

As you are using camera_name:='camera2' do you have more than one camera enabled at the same time?

I note from the title of this case that you are using both depth and RGB. Does the FPS improve if you disable the RGB option auto_exposure_priority with the instruction below?

ros2 param set /camera/camera rgb_camera.auto_exposure_priority false

MartyG-RealSense avatar Oct 13 '22 12:10 MartyG-RealSense

As you are using **camera_name:='camera2' ** do you have more than one camera enabled at the same time?

I note from the title of this case that you are using both depth and RGB. Does the FPS improve if you disable the RGB option auto_exposure_priority with the instruction below?

ros2 param set /camera/camera rgb_camera.auto_exposure_priority false

Yes, the idea was to run 4 RS cameras streaming both RGB and depth with difference resolution and FPS. But the FPS drop is reproducible with only 1 RS. I will try the auto_exposure_priority params and let you know the result

guoqingzh avatar Oct 13 '22 13:10 guoqingzh

@MartyG-RealSense the suggested parameters auto_exposure_priority false doesn't help. For depth, I set it to 30 FPS but only got ~13 FPS. But if I set depth_module.enable_auto_exposure to true , that seems to help (increase from 13 fps to 27 fps but still not 30 fps )

guoqingzh avatar Oct 14 '22 14:10 guoqingzh

For the disabling of auto_exposure_priority to work, auto_exposure must also be set to true in order for a constant FPS rate to be enforced. So if you have auto_exposure_priority = false and auto_exposure = true and FPS increases from 13 to 27, then the FPS rate enforcement mechanism activated by setting the priority to false may be working correctly. There could be another factor pulling the overall FPS down from 30 to 27 though.

Is 27 fast enough for your particular project if 30 cannot be achieved, or does it need to be as close to 30 as possible?

MartyG-RealSense avatar Oct 14 '22 16:10 MartyG-RealSense

Hi @guoqingzh Do you have an update about this case that you can provide, please? Thanks!

MartyG-RealSense avatar Oct 20 '22 06:10 MartyG-RealSense

@MartyG-RealSense we are doing performance testing. We want the FPS to be exactly the value we set with +/- 1 error maximum .

guoqingzh avatar Oct 20 '22 07:10 guoqingzh

@MartyG-RealSense We have the following findings while testing:

  1. if we subscribe to the RS topic from another docker container, it seems to have impact on FPS (make it reaching 30FPS) but if we stop the subscription it starts to decreasing
  2. One the same PC, realsense viewer can streams desired FPS up to 4 cameras simulatenously.

To me, the problem is either in ros2 or realsense_ros2 node

guoqingzh avatar Oct 20 '22 07:10 guoqingzh

Which versions of the librealsense SDK and ros2_beta wrapper are you using, please? For example, librealsense version 2.51.1 should be matched with ros2_beta wrapper version 4.51.1

Do you see any improvement in performance if you reset the cameras at launch with initial_reset

ros2 launch realsense2_camera rs_launch.py camera_name:='camera2' serial_no:="'_xxxxxxxxx'" rgb_camera.profile :='1280,720,30' initial_reset:=true

MartyG-RealSense avatar Oct 20 '22 11:10 MartyG-RealSense

I'm also having massive issues with FPS on the ROS2 realsense wrapper. I have noetic (ROS1) and foxy (ROS2) installed on the same machine. I recorded bags of /camera/color for both ROS1 and ROS2, the ROS1 bags have no issue, framerate is exactly as expected, ROS2 has significant frame drop. I'm using the latest versions of the RealSense wrapper in the ROS apt-get repos for both noetic and foxy. I also tried using the one from the ros2-beta branch but got worse results.

dheera avatar Oct 20 '22 19:10 dheera

Hi @dheera Please create a new case for your problem by visiting the link below and clicking the green New Issue button. Thanks!

https://github.com/IntelRealSense/realsense-ros/issues

MartyG-RealSense avatar Oct 21 '22 10:10 MartyG-RealSense

Hi @guoqingzh. I also had issues with FPS using D455 camera and running depth and RGB streams. The issue is resolved if running in auto exposure mode. There is a bug (probably) that blocks me from setting auto exposure to true when starting the camera node, so what I do is add a delayed action in the launch file to set it a bit later:

TimerAction( period=10.0, actions=[ ExecuteProcess( cmd=[[ 'ros2 param set /camera/camera depth_module.enable_auto_exposure true' ]], shell=True ) ] ),

Gilaadb avatar Oct 25 '22 09:10 Gilaadb

Hi @guoqingzh. I also had issues with FPS using D455 camera and running depth and RGB streams. The issue is resolved if running in auto exposure mode. There is a bug (probably) that blocks me from setting auto exposure to true when starting the camera node, so what I do is add a delayed action in the launch file to set it a bit later:

TimerAction( period=10.0, actions=[ ExecuteProcess( cmd=[[ 'ros2 param set /camera/camera depth_module.enable_auto_exposure true' ]], shell=True ) ] ),

Yes, Gilad. Alex told me the work around. I am reporting this to librealsense to let them fix the "bug"

guoqingzh avatar Oct 25 '22 10:10 guoqingzh

Hi @guoqingzh Do you require further assistance with this case, please? Thanks!

MartyG-RealSense avatar Oct 31 '22 07:10 MartyG-RealSense

see #2507 for more information about this issue.

SamerKhshiboun avatar Jan 31 '23 23:01 SamerKhshiboun

#2612

SamerKhshiboun avatar Mar 22 '23 15:03 SamerKhshiboun