-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How to downsample pointcloud and it's performance (decimation filter) #1964
Comments
Hi @Combinacijus As you are using a Jetson that has an Nvidia graphics GPU, it may be worth first adding CUDA graphics acceleration support to your RealSense configuration if you do not have CUDA enabled already. Doronhi the RealSense ROS wrapper developer comments about use of CUDA in RealSense ROS in the link below. My understanding of that discussion is that Doronhi advises that the RealSense ROS Debian packages do not include CUDA support. CUDA support can instead be built in librealsense using -DBUILD_WITH_CUDA=true, as mentioned in the instructions on Intel's Jetson installation page. https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_jetson.md You could also investigate using a decimation filter to reduce depth scene complexity. If you plan to use align_depth in your pointcloud in combination with a decimation filter then Doronhi provides advice about this in the link below. |
@Combinacijus Hi, I was originally going to get a Jetson AGX Xavier to host my realsense cameras (2~4). But since I noticed the most critical resource to host multiple cameras is the CPU capacity, and it seems like by default the cameras tend to exploit a single CPU thread than distribute the computation through all threads, I decided to go with a i7 up xtreme instead (beefy CPU per thread, similar price to AGX, great compatibility with realsense product... but sadly no CUDA)(https://up-shop.org/up-xtreme-series.html). At the time, the -DBUILD_WITH_CUDA=true option hasn't came up yet (or I just not aware of it). I am very interested in staying in touch and knowing how this build option effects the performance / cpu usage of AGX Xavier. Btw, for me, setting the decimation filter with a magnitude of 4 cut the CPU usage in half. (I checked it via system monitor on Ubuntu. It is not a very precise way to measure the exact CPU usage. But it is enough to know that decimation filter is making a significant difference. If you are not trying create a highly detailed map using the camera, this is a good way to do it) Thanks! |
Thank You so much @MartyG-RealSense! It's really nice to have support from such people like you who knows issues in and out I appreciate that @mszuyx did some tests. Do you remember what CPU usage you were getting and do you think my results are reasonable? So I made this lengthy comment with steps how to reproduce it and results at the end. I'm sure it will be handy for me in a future and hopefully to other. Also note that cpu usage in original question was measured in different power mode so don't compare it with this comment. Setup for librealsense performance testing:Jetson setup
Check realsense packages and versions
Uninstall librealsense. #950 (comment)
Download librealsense (tag v2.48.0 currently latest version) and general setup
Build setup. Build flagslibrealsense
realsense-ros I have built from source so my ros setup:
Test performanceLaunching rs_camera with pointcloud filter
Measure cpu usage with rqt_top my fork for total cpu usage with regex
Rebuild with different flags... RepeatJetson AGX Xavier MAXN power mode performance test resultsCPU usage is eyeballed average. 100% means that 1 cpu core is used fully. Jetson Xavier on MAXN power mode have 8 cores available that means 800% available cpu. librealsense is built with different methods. realsense-ros not changing. Test command: Results:
Installed from apt || CPU: ~75%
RSUSB 0 | CUDA 1 || CPU: ~75%
RSUSB 1 | CUDA 1 || CPU: ~82%
RSUSB 0 | CUDA 0 || CPU: ~110%
RSUSB 1 | CUDA 0 || CPU: ~113%
librealsense installed from apt AND realsense-ros installed from apt (unlike tests above) || CPU: 106%
realsense-ros from apt have poor performance probably because old version were installed:
After deleting realsense-ros and rebuilding from source performace is back to normal ~75%
Reduced output of rs_camera.launch (frame sizes, frame rate etc.)
Decimation filter performace testContinuing with last test best performer (librealsense apt, realsense-ros from source) but adding decimation filter. (For some reason even without decimation filter new launch file performs a bit better although I copy pasted it) rs_camera.launch file changes for decimation filter
Results decimation filter
ConclusionBest performing option is to:
Decimation filter with magnitude of 2 or 3 significantly improves performance but reduces resolution which might be ok depending on use case. Other things to try would be reducing resolution and fps or disabling rgb camera. From the tests it seems like librealsense in apt is built For now I'll stick with apt version of liberalsense and built from source realsense-ros. Downside of this is that liberalsense might update automatically and I'll need to match version manually. NotesWhen running rs_camera.launch file build versions will be printed like:
So make sure it's matching because I had some trouble to cleanly rebuild/reinstall librealsense and realsense-ros because apt and manual build were mixed up. Best to delete both (or should I say all 4: apt and built versions for both) and install/build again. Questions
Thanks again! |
Thanks so much @Combinacijus for your deeply detailed report that is sure to be of benefit to future readers in the RealSense ROS community! In regard to your questions:
|
@Combinacijus Yes, I think the CPU usage makes sense. Actually I am seeing similar numbers in Up xtreme with D455. (~106% with 1280 x 720 RGB and 848 x 480 pointcloud) I am also working multi-camera setup with D455. You are welcome to DM me on [email protected] and exchange experience. For my application, I am using multiple cameras to gain bigger FOV for robot navigation. Since I don't care the texture of the obstacles in this context, I also managed to save a bit more CPU by streaming textureless pointcloud. #1924 BTW, I want to appreciate your decimation magnitude vs CPU table. This tells us the most cost effective setting for the decimation filter is 2~4. |
Running
roslaunch realsense2_camera rs_camera.launch
takes 25% CPU (on single core) on Jetson AGX XavierBut enabling pointcloud
roslaunch realsense2_camera rs_camera.launch filters:=pointcloud
CPU usage goes to 112%I'm not sure if this is ok cpu usage or too high. But I assume by down-sampling pointcloud data before publishing would save cpu resources.
Is it possible to downsample pointcloud with ros wrapper?
The text was updated successfully, but these errors were encountered: