# hector_mapping reducing cpu consumption?

Hi I'm using hector_mapping on pandaboard es with arch linux+hydro installed. I have hokuyo urg 04lx. However when i start mapping with default settings. rosrun urg_node urg_node roslaunch hector_mapping mapping_default.launch (Static transform from base_footprint to laser) Nothing else However, when i type "top" to see its cpu usage. It shows nothing below %105.. how can i reduce this. It this normal? Am i doing something wrong? Is it better option for me to use laser_scan_matcher + gmapping

Edit: I installed ros-base from Aur repository using yaourt. After that i cloned hector_slam from from github to my catkin directory and catkin_make only hector_mapping (i installed every dependencies of it)

edit retag close merge delete

Sort by » oldest newest most voted

To complete @StefanKohlbrecher's answer, the problem is that you built a part of the packages without the proper release flags. Basically, when you use the AUR's PKGBUILDs, the release flag is forwarded to CMake, but if you compile from source with catkin_make, you need to take care of this yourself.

That being said, I just added hector_mapping and its dependencies to the AUR. Remove whatever you installed with catkin_make, install ros-hydro-hector-mapping with yaourt, and you should be just fine. If you encounter any other missing packages in the AUR, please send a package request here, or even better: make a fork, generate the PKGBUILDs yourself, and send me a pull request. Note that generating, compiling, installing and sending to the AUR the missing PKGBUILDs took me less than 5 minutes, so this is definitely worth installing things this way, rather than relying on catkin_make.

more

I haven´t tried things on Pandaboard, so not sure what to expect. That being said, I also noticed that CPU consumption lately was much higher than normal (nearly maxing out a i7 core on our USAR vehicles). As there haven´t been changes to the code in quite some time, I suspect that there might be a problem with one of the used libraries or the build settings. Can you edit your question with information on how you generated the executables (installed from .debs or compiled yourself)?

/edit: There seems to be something wrong with compile flags, see hector_slam issue 11

/edit2: I´d recommend building explicitly in Release mode as suggested in above ticket, just to make sure.

more

I think it is normal. I run hector_mapping on an Intel PC and I used to see hector_mapping over 100% all the time.

You can adjust the parameters (for me, they're in hector_mapping/mapping_default.launch) to ignore as much of the laser scan as possible. Bump up laser_min_distance. Bump down map_pub_period and laser_max_distance. Maybe there are a few other parameters that have some effect. You can see a list of params on the wiki page. In hector_nav.launch, decrease the map size.

A hacky fix: you can install cpulimit and throttle the CPU usage to whatever you please. I'm using 80% without any noticeable ill effects:

cpulimit -e hector_mapping -l 80

more

1

This should only happen when you run things on a very weak CPU, otherwise it is very likely that you're compiling with no optimization.

( 2017-10-12 05:40:37 -0500 )edit

Thanks. With the parameter changes, CPU load has dropped from ~100% to 30%. Add to CMakeLists instead of typing catkin_make -DCMAKE_BUILD_TYPE=Release:

set_target_properties(hector_mapping PROPERTIES DCMAKE_BUILD_TYPE "Release")

( 2017-10-12 10:52:41 -0500 )edit