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

Incredibly slow with librealsense 2.45, realsense_ros 2.3.0 #1903

Closed
bibbygoodwin opened this issue May 28, 2021 · 39 comments
Closed

Incredibly slow with librealsense 2.45, realsense_ros 2.3.0 #1903

bibbygoodwin opened this issue May 28, 2021 · 39 comments
Labels

Comments

@bibbygoodwin
Copy link

bibbygoodwin commented May 28, 2021

Hi,

As this is my first realsense installation, I have no frame of reference, but launching rs_rgbd.launch or rs_camera.launch cause ~140% CPU usage by nodelet, and present frames at ~2fps in RViz. The entire computer (8-core 2.9GHz, 16GB ram) becomes almost unusable.

I'm on librealsense 2.45, realsense_ros 2.3.0, using a D435i. I installed with:

apt-get install -y librealsense2-dkms
apt-get install -y librealsense2-utils
apt-get install -y librealsense2-dev
apt-get install -y librealsense2-dbg
apt-get install -y ros-melodic-realsense2-camera
apt install -y ros-melodic-rgbd-launch

This seems to be a problem reported by others e.g. at #1887

I have tried switching off as much processing in the launchfiles as I can, but this doesn't seem to change anything

realsense-viewer uses ~95% CPU with just the stereo module on, and frame drops are around 65% there.

@MartyG-RealSense
Copy link
Collaborator

Hi @bibbygoodwin Let's focus on the RealSense Viewer performance first. Could you try disabling the Viewer's two GLSL options in its Settings interface please using the instructions in the link below to see whether doing so speeds up your computer.

IntelRealSense/librealsense#8110 (comment)

@hardesh
Copy link

hardesh commented Jun 2, 2021

Hello,
Facing the same issue on Jetson Nano. The nodelet is taking around 30%-40% CPU now. Earlier it used to take 12%-13% CPU

@MartyG-RealSense
Copy link
Collaborator

Hi @hardesh Do you also experience a CPU usage increase in the RealSense Viewer like @bibbygoodwin does, please?

@hardesh
Copy link

hardesh commented Jun 2, 2021

Hi @MartyG-RealSense,
I didn't check the CPU usage with realsense viewer. Will get back to you in a week
For now I've reverted back to librealsense v2.42 and realsense ros v2.2.22

@MartyG-RealSense
Copy link
Collaborator

Thanks very much for the information @hardesh

@MartyG-RealSense
Copy link
Collaborator

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

@hardesh
Copy link

hardesh commented Jun 18, 2021

Hi @MartyG-RealSense,
Sorry, haven't had a chance to try out the latest versions again. I Will let you know once I get the chance

@MartyG-RealSense
Copy link
Collaborator

No problem at all @hardesh - I will keep this case open for a further time period. Thanks for the update!

@Giggus
Copy link

Giggus commented Aug 13, 2021

Hi,

I have a similar issue here.

My SW setup is:

  • Ubuntu 20.04
  • kernel 5.8.0-63-generic
  • ROS noetic
  • librealsense2 2.48.0
  • ros-noetic-realsense2-camera (2.3.1)

My hardware is:

  • MSI gaming laptop (MS-17F5)
  • RAM : 15 GB
  • Intel® Core™ i7-10750H CPU @ 2.60GHz × 12

My issue:
Launching roslaunch realsense2_camera rs_rgbd.launch I get CPU 100% just subscribing both image and depth topics on rviz. If I also publish the point cloud the CPU jumps to 105% for realsense2_camera_manager and 120% for rviz.

I am wondering if this is normal or if I am doing something wrong here.

I also tried (with no improvement):

  • ROS melodic In a docker environment
  • I switched all CPU governors to "performance"
  • Installed librealsense2 2.49.0

Any suggestion would be very much appreciated.

Cheers!

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 13, 2021

Hi @Giggus Could you try the alternative launch instruction below please for rs_camera.launch, which should generate an ordered pointcloud like rs_rgbd does. Does this instruction provide any improvement in CPU usage?

roslaunch realsense2_camera rs_camera.launch filters:=colorizer,pointcloud align_depth:=true pointcloud_texture_stream:=RS2_STREAM_COLOR ordered_pc:=true

@Giggus
Copy link

Giggus commented Aug 13, 2021

Hi @MartyG-RealSense thanks for the quick reply.

By running your command I get CPU usage up to 140% for realsense2_camera_manager and 130% for rviz
Screenshot from 2021-08-13 15-50-27

P.s. I am using a L515 camera (I don't know if it does make a difference)

@MartyG-RealSense
Copy link
Collaborator

Use of the L515 model should not make a difference with ROS. A standard first step though in diagnosing problems related to L515 is to unplug the USB cable from the base of the camera (not from the computer end), turn it around in the opposite orientation and re-insert it (USB-C cables are two-way insertion at the micro-sized end). Is CPU usage the same afterwards?

@Giggus
Copy link

Giggus commented Aug 13, 2021

If I plugged it reversed I can only get very low resolution streams (i.e. depth only at 320x240) - so I always plug in the orientation that gives me access to high resolution rgb and depth streams.

Any other hints on what could it be causing this high CPU usage?

@MartyG-RealSense
Copy link
Collaborator

Okay, you had the micro-sized end in the appropriate orientation already then if you could only access 320x240 when rotating the connector. Thanks very much.

Does the L515's outer casing feel hot to the touch after the camera has been running for a few minutes?

@Giggus
Copy link

Giggus commented Aug 13, 2021

Yes it does why?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 13, 2021

Rapid overheating can indicate that there is an electrical problem with the USB system that is heating up the camera. This may be caused by a bad USB cable or a glitch on the USB port that the camera is plugged into.

@Giggus
Copy link

Giggus commented Aug 13, 2021

what I observe is sometimes the full camera just stopping to work and then come back live.
I plugged the camera to the usb3.2 port of my laptop, I can't see how that could create glitches..

Do you think the heating is related to the high CPU usage?

@MartyG-RealSense
Copy link
Collaborator

It is certainly abnormal that the camera casing is hot to the touch after only a few minutes of streaming. Could you launch the camera in the RealSense Viewer, enable the depth stream and observe the temperatures (shown as yellow bars) in the Controls section of the 'L500 Depth Sensor' side-panel options and see what the temperature is after a few minutes?

image

@Giggus
Copy link

Giggus commented Aug 13, 2021

After 10 minutes the temperature is
Screenshot from 2021-08-13 16-31-27

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 13, 2021

Thank you. The internal temperatures are on the high side but not extremely so. Do you have an alternative USB 3.2 port that you can try the camera in on the laptop? My understanding is that if there is an electrical overheating issue on a port then it affects devices with a high power draw (e.g external disk drives) rather than simple devices such as keyboard and mouse.

@Giggus
Copy link

Giggus commented Aug 13, 2021

I already tested the device on all usb 3.2 ports and nothings changes

@MartyG-RealSense
Copy link
Collaborator

I located a case in which similarly high processor usage such as 113% was occuring on a gaming laptop, whilst usage on a different desktop PC was less than 30%. Curiously, usage was 41% when simply reading the topic with rostopic echo, but shot up to 113% when RViz was being used.

IntelRealSense/librealsense#1130 (comment)

@Giggus
Copy link

Giggus commented Aug 13, 2021

Thanks for the link.. It seems to be exactly the same issue I have.
No solution or temporary hack has been found yet? :(

@MartyG-RealSense
Copy link
Collaborator

You could test whether setting RViz to use compressed data instead of raw makes a difference to the CPU usage.

image

@Giggus
Copy link

Giggus commented Aug 16, 2021

Hi @MartyG-RealSense, after installing image_transport_plugins the CPU goes down to 100% for realsense_manager and to 30% for rviz (which is already good news).
Screenshot from 2021-08-16 10-07-11

If I subscribe to the pointcloud the CPU jumps back to crazy values
Screenshot from 2021-08-16 10-09-29

Might it be because a transport package for the pointcloud is required?

@MartyG-RealSense
Copy link
Collaborator

Hi @Giggus It's excellent to hear that you made positive progress.

image_transport is associated with transmission of compressed data and is not required by default for pointcloud generation.

@Giggus
Copy link

Giggus commented Aug 16, 2021

I made some progress but using pointcloud is still not possible with such CPU consumption. I am trying to understand where such high CPU usage comes from..

@MartyG-RealSense
Copy link
Collaborator

A RealSense ROS user in the link below had similarly high CPU usage with pointcloud and reduced it significantly by applying a Decimation Filter, at the cost of a reduction in resolution.

#1964

@Giggus
Copy link

Giggus commented Aug 16, 2021

Thanks @MartyG-RealSense. I tried but didn't see any difference. Do you think that decimation filter does actually apply also to the L515 camera (since depth is obtained by the embedded Lidar rather than from stereo cameras)?

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 16, 2021

Although the Decimation filter does not appear in the list of depth post-processing filters in my RealSense Viewer, i did confirm that the rs-post-processing C++ SDK example program could access and control decimation of the depth image with an L515. The images below show an L515 image with the Decimation filter's Filter Magnitude setting set to '2' (upper image) and '4' (lower image).

image

image

@Giggus
Copy link

Giggus commented Aug 17, 2021

Hi @MartyG-RealSense , thanks for the reply!!
I tried to add the decimation filter but I didn't see any change to my pointcloud.
I am launching the nodelets with rs_rgbd.launch, might this be the issue?

For the moment the only solution I found to reduce the CPU usage is to reduce the color_fps to 6 (I can't decrease the depth_fps with the L515 apparently).

Cheers!

@MartyG-RealSense
Copy link
Collaborator

Thanks very much @Giggus - yes, depth and infrared FPS is fixed at 30 on the L515.

@MartyG-RealSense
Copy link
Collaborator

Hi @Giggus Do you require further assistance with your question above, please? Thanks!

@Giggus
Copy link

Giggus commented Aug 23, 2021

Hi @MartyG-RealSense, thanks for your assistance.

For the moment I "solved" the problem by reducing the color frame rate to 6 fps (consequently the point cloud rate reduces as well). This result is not optimal since the same script loads the CPU a third on a different PC. So I do think there is still a problem (maybe PC related). But at least with current configs I can keep working with some CPU resources still available.

Cheers!

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 23, 2021

You are very welcome, @Giggus

@MartyG-RealSense
Copy link
Collaborator

@hardesh You also had problems on this case - is your problem now resolved, please? Thanks!

@hardesh
Copy link

hardesh commented Aug 23, 2021

Hi @MartyG-RealSense, sorry i haven't tried installing librealsense 2.45. v2.42 with realsense-ros 2.2.22 is giving us good results, so we're sticking to that

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Aug 23, 2021

Okay @hardesh thanks - as long as you are satisfied with your current setup with librealsense 2.42.0 and wrapper 2.2.22 then that's totally fine.

@MartyG-RealSense
Copy link
Collaborator

As everyone is satisifed with their outcomes, I will close the case. You are welcome to add further comments after closure if you have additional enquiries abut the topics covered in this dscussion. Thanks again!

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

4 participants