Mapping performance funing in rtabmapviz

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Mapping performance funing in rtabmapviz

simon.xm.lee
This post was updated on .
Hi Mathieu,

    I encounter the performance problem while mapping. It is lag(about 2 seconds) in rtabmapviz. I follow this suggestion. I reduce the decimation of map and odometry from 4 to 1 in rtabmapviz, but the frame showing in rtabmapviz is still lag(about 2 seconds).


My hardware information is as below.
(1) Nvidia Jetson TX1 developer board
(2) Robot(Pioneer-P3DX)
(3) KinectV2.  


My launch file for mapping: (Kinect + Odometry)
simon_rgbd_mapping_kinect2.launch


The nvidia board has good GPUs, so I think the performance in rtabmapviz should be smooth. Do you have other suggestions?

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

matlabbe
Administrator
Hi Simon,

You need to increase decimation to increase rendering performance (try with 8). Do you have similar lag with RVIZ? Is the Odometry or loop closure detection view which is lagging (or both)?

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

simon.xm.lee
This post was updated on .
Hi Mathieu,

Now I use opencv with cuda support, but it is lagging too.

[use rtabmapviz]

I use robot odometry instead of rgbd odometry, so the "odometry" view is black.

After I increase decimation from 4 to 8, it is still lagging both in "loop closure detection" view and "3D Map" view.
I even increase to 12, and it is still lagging.


[use RVIZ]
The RVIZ has problem now, so I cannot try it. I will update the result since it is ready.


Regards.
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

matlabbe
Administrator
Hi,

Note that loop closure view would update only at 1 Hz, as well as the map update in 3D Map view. Can you record the screen and share the video of the problem?

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

simon.xm.lee
This post was updated on .
Hi Mathieu,

Please reference my video. There are some delays from robot finishing rotating to rtabmapviz finishing updating 3D map. The delay is above 3 seconds and it seem not smoothly.

[Video]

https://drive.google.com/file/d/0BzOfb393F8TvSmUtcU40aVB2d3c/view?usp=sharing



I add logs to check the the depthOdomCallback dealing time. It can be done in 0.7 seconds. I think it shouldn't be the bottleneck of performance.

[Log]

rtabmap_log_20170516.log


I find sometimes it took about 1 second from depthOdomCallback done to next depthOdomCallback be called. Therefore I check rostopic hz [topic] for odom, image_color_rect, image_depth_rect, camera_info and find the rate of image_color_rect, image_depth_rect, camera_info would drop to about 0.9. Does it might be the root cause for the delay?


Regards.


Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

matlabbe
Administrator
Hi Simon,

0.9 Hz is low for input image topics (if they are not synchronized). rgbd_odometry/rtabmap/rtabmapviz would have difficulty to synchronize them and drop some messages if so. Why are they so slow? Is iai_kinect2 package taking too much resources? You can do "$ top" when everything is running to see CPU usage. iai_kinect2 package may be configured to use GPUs of the jetson if it is not.

Just to make sure, rtabmapviz is launched on the jetson?

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

simon.xm.lee
Hi Mathieu,

Below is the CPU loading difference between launch launch file or not. It seem that lots of CPU resource is used by somethings which are loaded into nodelet by rtabmap, not iai_kinect2.

[kinect2_bridge + robot navigation stack]
1. move_base(36%)
2. firefox(2%)
3. nodelet(1%)

[kinect2_bridge + robot navigation stack + rtabmap]
1. nodelet(37%)
2. move_base(36%)
3. rtabmap(4%)



iai_kinect2 package may be configured to use GPUs of the jetson if it is not.
=> I didn't enable iai_kinect2 with GPU acceleration yet. I will try to enable it.

Just to make sure, rtabmapviz is launched on the jetson?
=> Yes, I run the rtabmapviz on Jetson. I didn't use remote mapping.


Regards.
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

matlabbe
Administrator
This post was updated on .
Hi,

There are no nodelets in rtabmap launch file you posted above (when rviz argument is false). I guess "nodelet" refer to iai_kinect2. I think iai_kinect 2 doesn't start the streams if nobody is subscribed to its topics, so maybe why there is no CPU usage when not launching rtabmap. You may try again [kinect2_bridge + robot navigation stack]  test with subscribing to rgb and registered depth images:
$ rostopic hz /kinect2/qhd/image_color_rect
$ rostopic hz /kinect2/qhd/image_depth_rect
then look again the cpu usage.

Note that the depth and rgb streams should have a steady frame rate, otherwise you will notice lags. Indeed, using GPU version of iai_kinect2 may help to save some CPU. To make it work on Jetson, you may look at the link referred here : http://official-rtab-map-forum.206.s1.nabble.com/Remote-mapping-Kinect2-tp2980p2986.html

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

simon.xm.lee
Hi Mathieu,

By the way, does "3D Map" view update by _cloudViewer->update() in MainWindow::updateMapCloud()?

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

matlabbe
Administrator
When it receives /rtabmap/mapData. You can also check the framerate of this topic, it should be steady 1 Hz:
$ rostopic hz /rtabmap/mapData

When rtabmapviz receives this topic, it updates the 3D map view. "_cloudViewer->update()" is used to refresh rendering of the Qt widget after adding the cloud.

cheers,
Mathieu
Reply | Threaded
Open this post in threaded view
|

Re: Mapping performance funing in rtabmapviz

simon.xm.lee
In reply to this post by matlabbe
Hi Mathieu,

I think iai_kinect 2 doesn't start the streams if nobody is subscribed to its topics, so maybe why there is no CPU usage when not launching rtabmap.
=> You are right.


I follow steps to enable cuda as depth_method for libfreenect2.

process[kinect2_bridge-3]: started with pid [3009]
[ INFO] [1495106888.817408848]: Loading nodelet /kinect2_bridge of type kinect2_bridge/kinect2_bridge_nodelet to manager kinect2 with the following remappings:
[ INFO] [1495106888.933679200]: [Kinect2Bridge::initialize] parameter:
        base_name: kinect2
           sensor: default
        fps_limit: -1
       calib_path: /home/ubuntu/catkin_ws/src/iai_kinect2/kinect2_bridge/data/
          use_png: false
     jpeg_quality: 90
        png_level: 1
     depth_method: cuda
     depth_device: -1
       reg_method: default
       reg_device: -1
        max_depth: 12
        min_depth: 0.1
       queue_size: 5
 bilateral_filter: true
edge_aware_filter: true
       publish_tf: true
     base_name_tf: kinect2
   worker_threads: 4
[Info] [CudaDepthPacketProcessorImpl] device 0: NVIDIA Tegra X1 @ 72MHz Memory 3994MB
[Info] [CudaDepthPacketProcessorImpl] selected device 0


The performance has no significant improvement. The value of "rostopic hz /rtabmap/mapData" is only about 0.6 as before. I find the "kinect2/qhd/image_depth_rect" is usually slow(0.88) and I still try to find out the reason.

Regard.