Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

D405 fps #2486

Closed
DaphnaNanovel opened this issue Sep 20, 2022 · 53 comments
Closed

D405 fps #2486

DaphnaNanovel opened this issue Sep 20, 2022 · 53 comments
Labels

Comments

@DaphnaNanovel
Copy link

Hello,
we switched from D435 to D405 and faced very strange issue - we can't run D405 faster than 15 FPS.
We tested in both on Jetson NX and on PC.
We installed the ros2_beta and we run the
ros2 launch realsense2_camera rs_launch.py
When we run this on D435 we get 30 FPS on topic /camera/color/image_raw
The same command on D405 provides only 15 FPS on topic /camera/color/image_rect_raw
And any tries to run the command with rgb_camera.profile:=640,480,60 (or 30) also gives only 15FPS.
Moreover, camera reports 30/60 fps by ros logger.

We measure the FPS with ros2 topic hz command
Any suggestions?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 20, 2022

Hi @DaphnaNanovel Do you experience the FPS drop with the D405 camera model if you launch with ros2 run instead of ros2 launch, please?

ros2 run realsense2_camera realsense2_camera_node

@DaphnaNanovel
Copy link
Author

DaphnaNanovel commented Sep 21, 2022

Hi @MartyG-RealSense,
When we run with ros run, we do get higher fps (~20 on Jetson NX, and ~30 on PC), but we couldn't control the height and width of the frames (both color and depth frames). we tried with ros2 param set and with --ros_args. The ros2 param list shows no option for rgb_camera.profile.We were able to set depth_module.profile with our values, but it does not affect the dimension of the depth image.
Do you have any suggestions?

@MartyG-RealSense
Copy link
Collaborator

Thank you very much for the feedback. What happens with ros2 launch if you use 90 FPS for the 640x480 rgb_camera profile and 30 for the depth?

@DaphnaNanovel
Copy link
Author

Screenshot from 2022-09-21 12-40-17

@MartyG-RealSense
Copy link
Collaborator

The log says that the color is using 30 FPS instead of 90 FPS.

@DaphnaNanovel
Copy link
Author

yes, but you can see the command above:
ros2 launch realsense2_camera rs_launch.py enable_sync:=true rgb_camera.profile:=640,480,90 depth_module.profile:=640,480,30

@MartyG-RealSense
Copy link
Collaborator

What happens if you remove enable_sync:=true ?

@DaphnaNanovel
Copy link
Author

same ...
Screenshot from 2022-09-21 12-47-17

@MartyG-RealSense
Copy link
Collaborator

Okay, thanks. So enable_sync being disabled does not make a difference when using ros2 launch. And you get good performance with ros2 run but have the problem of how to set a custom stream configuration.

@DaphnaNanovel
Copy link
Author

Correct

@MartyG-RealSense
Copy link
Collaborator

Are you able to configure the streams with ros2 run using the instruction below?

ros2 run realsense2_camera realsense2_camera_node --ros-args -p depth_width:=640 -p depth_height:=480 -p depth_fps:=30.0 -p color_width:=640 -p color_height:=480 -p color_fps:=30.0

@DaphnaNanovel
Copy link
Author

The dimension are 848x480, fps is ~2

Screenshot from 2022-09-21 13-09-21

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 21, 2022

Okay, that likely means that the custom configuration was deemed invalid by the launch and the camera's default stream configuration was applied instead.

Thanks very much for your patience during this support process!

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 21, 2022

Going back to ros2 launch, let's next try setting the pointcloud texture to mode '0' instead of the default '2'.

ros2 launch realsense2_camera rs_launch.py rgb_camera.profile:=640,480,30 depth_module.profile:=640,480,30 pointcloud.stream_filter:=2

@DaphnaNanovel
Copy link
Author

Screenshot from 2022-09-21 13-31-31

@MartyG-RealSense
Copy link
Collaborator

You are not using a pointcloud anyway so that setting would not make a difference. Apologies for that!

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 21, 2022

Given that the ros2_beta wrapper documentation suggests expressing the profile with 'x' between the stream settings instead of commas, can we try it with x's please just to eliminate it as a cause of the problem (as the launch works normally with D435, it probably is not the cause).

ros2 launch realsense2_camera rs_launch.py rgb_camera.profile:=640x480x30 depth_module.profile:=640x480x30

@DaphnaNanovel
Copy link
Author

Yes, I saw it in the readme and tried it. As you assumed, that's not the problem...
Is there any incompatibility between these versions: RealSense ROS v4.0.4 and Built with LibRealSense v2.51.1?

@MartyG-RealSense
Copy link
Collaborator

The ros2_beta wrapper was updated to 4.51.1 for matching with 2.51.1 about a week ago. Wrapper 4.0.4 was stable with 2.51.1 but it was designed for use with 2.50.0.

https://github.com/IntelRealSense/realsense-ros/releases/tag/4.51.1

@MartyG-RealSense
Copy link
Collaborator

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

@DaphnaNanovel
Copy link
Author

Hi @MartyG-RealSense, yes we do..
same problem..
Thank you!

@MartyG-RealSense
Copy link
Collaborator

Were you able to test with librealsense 2.51.1 and wrapper 4.51.1 and found that the same problem was occurring?

@DaphnaNanovel
Copy link
Author

Yes.. It says it is running with 30 FPS but actually when we check with ros2 topic hz we get at max 15 FPS (tested on a PC and not on Jetson)

@MartyG-RealSense
Copy link
Collaborator

In tests with the D405 I observed that the FPS could halve from 30 to 15 if auto-exposure became disabled. Please test launching with auto-exposure enabled via the launch instruction to see whether the FPS becomes 30.

ros2 launch realsense2_camera rs_launch.py rgb_camera.profile:=640x480x30 depth_module.profile:=640x480x30 enable_auto_exposure:=true

@DaphnaNanovel
Copy link
Author

image

@MartyG-RealSense
Copy link
Collaborator

Device USB Type is reported as '2.1' in the log, indicating that it is detecting the camera as being on a slower USB 2.1 connection instead of a full-speed USB 3 connection.

If the D405 is plugged into a USB 3 port, please add initial_reset:=true to reset the camera at launch to see whether this corrects the detected USB connection to 3.1 or 3.2.

ros2 launch realsense2_camera rs_launch.py rgb_camera.profile:=640x480x30 depth_module.profile:=640x480x30 enable_auto_exposure:=true initial_reset:=true

@DaphnaNanovel
Copy link
Author

I'm now trying your suggestions, and I see that it says we are connected to USB 2.1. But if you scroll up to the previous messages you will see that it was detected with USB 3 when I used another Jetson or my PC

@DaphnaNanovel
Copy link
Author

@MartyG-RealSense
Here is when it is USB 3.2
Thank you for noticing another issue we had.
Screenshot from 2022-09-29 18-12-27

@MartyG-RealSense
Copy link
Collaborator

Hi @DaphnaNanovel My sincere apologies for the delay in responding further.

The log image reports UVC metadata payloads not available. This suggests that a kernel patch might not have been applied. What methods do you use to install librealsense and the ROS wrapper on Jetson and on PC, please?

@DaphnaNanovel
Copy link
Author

@MartyG-RealSense,
Thank you for your response!

It indeed can be the problem because we used the "classical" way to install both librealsense and ROS wrapper.
The instruction for librealsense installation were taken from:
https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md
while the ROS wrapper was installed using this tutorial:
https://github.com/IntelRealSense/realsense-ros/tree/ros2-beta

Is there some kernel patch we have missed during the installation?

@MartyG-RealSense
Copy link
Collaborator

If you installed librealsense from packages using the distribution_linux.md instructions then the patch is included within the packages and not need to be applied separately. Those instructions work for PC but are not suitable for Jetson boards though.

Jetson boards have their own dedicated package installation procedure at the installation_jetson.md link below. The Jetson packages contain the Jetson kernel patch.

https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_jetson.md#4-install-with-debian-packages

@MartyG-RealSense
Copy link
Collaborator

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

@DaphnaNanovel
Copy link
Author

Hi @MartyG-RealSense, unfortunately the installation procedure with the installation_jetson.md didn't solve the problem. We are getting the same fps problem. Also on a computer with ros foxy.

Screenshot from 2022-10-12 15-29-24

@MartyG-RealSense
Copy link
Collaborator

When using the D435 you were using ros2 topic hz with the /camera/color/image_raw topic, whilst on D405 you checked the hz of /camera/color/image_rect_raw

Is /camera/color/image_raw published when launching the ROS wrapper with D405, and if it is then what is its hz rate?

@DaphnaNanovel
Copy link
Author

No, /camera/color/image_raw topic doesn't exist at all.
image

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Oct 13, 2022

You said at #2486 (comment) that when launching with ros2 run you could achieve 20 FPS on Jetson and 30 FPS on PC. Whilst with ros2 launch you can only achieve around 8 FPS on average. This suggests that the camera is capable of operating relatively normally (not a problem with the camera hardware, firmware driver, USB or Jetson) and that something resulting from the rs_launch.py launch file is reducing the FPS to 8.

In the log image above, depth and color is reported at the launch's conclusion ('RealSense Node is Up!') as being 30 FPS, so the drop is likely occurring after launch.

Exposure being changed automatically to a high value could cause this kind of FPS drop but D435 does not experience FPS problems when launched with the same method.

A difference between D435 and D405 is that D405 is not equipped with an IR projector to help to illuminate the scene. However, if a good FPS can be achieved by D405 with ros2 run then this suggests that the camera is not having problems with insufficient illumination on the observed object / surface.

We could next try disabling auto_exposure and setting different manual depth exposure values to determine whether it affects the FPS.

ros2 launch realsense2_camera rs_launch.py rgb_camera.profile:=640x480x30 depth_module.profile:=640x480x30 depth_module.exposure:=32000 depth_module.enable_auto_exposure:=false pointcloud.stream_filter:=2

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Oct 17, 2022

Hi @DaphnaNanovel After discussing the issue of 15 FPS on D405 but 30 FPS on D435 with my Intel RealSense colleagues, an bug report has been created to investigate the issue officially. This case should be kept open whilst the bug report is active.

@DaphnaNanovel
Copy link
Author

Hello @MartyG-RealSense ,
we added cyclone rmw to .bashrc and saw 15FPS on both Jetson and PC.
We can "live" with it, but if you manage to find the solution we'll appriciate it.
Thank you for your support!

@MartyG-RealSense
Copy link
Collaborator

You are very welcome, @DaphnaNanovel - thanks very much for the update!

@dheera
Copy link

dheera commented Oct 20, 2022

I'm also having major issues with FPS with D455, 20.04, foxy, using either ros2 run or ros2 launch. Has anyone been able to get RS working in ROS2 at all?

I have the ROS1 realsense package working just perfectly.

@MartyG-RealSense
Copy link
Collaborator

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

@SamerKhshiboun
Copy link
Contributor

See my comment in #2507 for more information.

@lifeisgood-ai
Copy link

Hi @MartyG-RealSense

Could you provide information on the progress of the bug report you mentionned about setting the FPS rate on D405 ?

I am also facing the issue. ros2 launch displays that the setting of my cam is set to 30 fps but in reaity it is blocked to 15 fps and no way to bypass. This is a problem to me as I use the D405 in multicam architecture where I get images at 30 fps and I need to get them synced for processing.

Thank you

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Feb 28, 2023

Hi @lifeisgood-ai This bug report is currently being actively worked on by the RealSense ROS developer team at the time of writing this. So work on it is progressing but I cannot provide a time estimate for release of a fix, unfortunately.

@SamerKhshiboun
Copy link
Contributor

SamerKhshiboun commented Mar 19, 2023

Hi @lifeisgood-ai , @DaphnaNanovel, @dheera

My name is Samer and I'm a developer in the RealSense SW team.
I'm investigating issues related to low FPSs in several scenarios, and my suggestion is to make sure that the auto_exposure is on.
Please read my comment here, and let me know if that helps.
#2507 (comment)

You might have to add "depth_module.enable_auto_exposure" to the launch file (which is missing from the launch file currently, and might cause not loading auto_exposure parameter correctly) with default value "True", like this:
{'name': 'depth_module.enable_auto_exposure, 'default': 'true', 'description': '...'},

Let me know if the above suggestions helped you.

Thanks,
Samer

@SamerKhshiboun
Copy link
Contributor

#2612

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 23, 2023

Hi everyone, is there anybody on this case who requires further assistance after the fix implemented by @SamerKhshiboun at #2612 and merged into the ros2_development ROS2 wrapper?

@lifeisgood-ai
Copy link

Hi Samer @SamerKhshiboun

Thank you for taking the issue.

I have been through your comment #2507 (comment) and applied what you suggest in your #2486 (answer).

I made a quick acquisition of RGB images to a ros bag using rs_launch.py adapting the configurable_parameters.

Simply adding the following line is not enough :

{'name': 'depth_module.enable_auto_exposure, 'default': 'true', 'description': '...'},

Commenting the two lines helps :

#{'name': 'depth_module.exposure.1', 'default': '7500', 'description': 'Initial value for hdr_merge filter'},
#{'name': 'depth_module.exposure.2', 'default': '1', 'description': 'Initial value for hdr_merge filter'},

Running rs_launch,

ros2 launch realsense2_camera rs_launch.py

I get 30 fps ! 👍

$ ros2 topic hz /camera/color/image_rect_raw
average rate: 29.555
min: 0.025s max: 0.067s std dev: 0.00636s window: 31

I also get 30 fps using the ros command line

$ ros2 run realsense2_camera realsense2_camera_node

This is good for me. I will test with multi cameras later this week if I get time.

Another point that might not be related is a warning of version differences. I compiled librealsense v2.53.1 as I run a Ubuntu 22.04 and my realsense-ros is built over librealsense 2.51.1

[realsense2_camera_node-1] [INFO] [1679744057.700592306] [camera.camera]: RealSense ROS v4.51.1
[realsense2_camera_node-1] [INFO] [1679744057.701034637] [camera.camera]: Built with LibRealSense v2.51.1
[realsense2_camera_node-1] [INFO] [1679744057.701147666] [camera.camera]: Running with LibRealSense v2.53.1
[realsense2_camera_node-1] [WARN] [1679744057.701233120] [camera.camera]: ***************************************************
[realsense2_camera_node-1] [WARN] [1679744057.701314466] [camera.camera]: ** running with a different librealsense version **
[realsense2_camera_node-1] [WARN] [1679744057.701384099] [camera.camera]: ** than the one the wrapper was compiled with! **
[realsense2_camera_node-1] [WARN] [1679744057.701460896] [camera.camera]: ***************************************************

Thanks
LG

@lifeisgood-ai
Copy link

hi @MartyG-RealSense @SamerKhshiboun
I tested adding a depth_module.exposure entry with a value of 7500 with depth_module.auto_exposure set to false and it works fine now.
still in my version of rs_launch.py I have 2 entries depth_module.exposure.1 and depth_module.exposure.2 by default.
Apart from that, all good for me.

@SamerKhshiboun
Copy link
Contributor

Hi @lifeisgood-ai,
I'm glad you are able to get 30 FPS now.
I suggest you see my last merged PR commit as I added another parameter named depth_module.exposure which we want to override through the rs_launch.py in order to make the 30 FPS works good, specially for D405 model.
see also the description in the PR itself to understand more about the FPS decrease reason.

Regarding your librealsense version issue, I guess you might have multiple librealsense versions installed in your system, and our wrapper is finding the first installed version first, according to its search path.
try running dpkg --list | grep realsense to see if you have multiple versions installed.

Thanks,
Samer

@ohadNanovel
Copy link

Hi @SamerKhshiboun , @MartyG-RealSense ,
I have just tested your new PR and solution and it worked for me both on my PC and Jetson. Thanks a lot for the investigation and the solution.

@DaphnaNanovel
Copy link
Author

Hi @SamerKhshiboun , @MartyG-RealSense , I have just tested your new PR and solution and it worked for me both on my PC and Jetson. Thanks a lot for the investigation and the solution.

Hi, I wrote this comment from another account by mistake. Thanks again!

@MartyG-RealSense
Copy link
Collaborator

That's great news that it worked for you, @DaphnaNanovel - thanks very much for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants