Ask Your Question

Hector mapping does not display the map well

asked 2012-12-02 13:22:42 -0500

Astronaut gravatar image

updated 2012-12-03 01:33:16 -0500


Im using hector mapping and have some small problems. I installed and compile the package. Than tried to load the map. At the beginning was working good, was loading the map from the bag file. Im using only laser and IMU as a sensor package and do not have any encoders ( so I do not have any odometry). After playing a different bag files I have some problems with the map. Actually the laser was not matching correctly the map during playing the bag file. I post a picture of the mapping . So you can see also my setting of the rviz and the launch file as well.

This is the launch file


    <param name="/use_sim_time" value="true"/>
    <node name="rosplay" pkg="rosbag" type="play" args="/home/bojan/svn/POW/ROS/Fuerte/Data/User1/pow_freek_3_2011-04-01-14-21-48.bag       --clock"/>
    <node pkg="tf" type="static_transform_publisher" name="baselink_laser" args="0 0 0 0 0 0 /base_link /laser 100"/>
    <node pkg="tf" type="static_transform_publisher" name="corner_a" args="0.45 0.3 0 0 0 0 /base_link /corner1 10"/>
    <node pkg="tf" type="static_transform_publisher" name="corner_b" args="0.45 -0.3 0 0 0 0 /base_link /corner2 10"/>
    <node pkg="tf" type="static_transform_publisher" name="corner_c" args="-0.45 -0.3 0 0 0 0 /base_link /corner3 10"/>
    <node pkg="tf" type="static_transform_publisher" name="corner_d" args="-0.45 0.3 0 0 0 0 /base_link /corner4 10"/>

    <node name="hector_mapping" pkg="hector_mapping" type="hector_mapping" output="screen">
        <param name="pub_map_odom_transform" value="true"/>
    <param name="map_frame" value="map"/>
        <param name="base_frame" value="base_link"/>
        <param name="odom_frame" value="base_link"/>
<node pkg="rviz" type="rviz" output="screen" name="rviz" args="-d $(find pow_analyzer)/launch/pow_rviz.vcg"/>

And this are the shots of the rviz

Here still all ok image description

And now starting the troubles image description image description image description

Any help?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-12-03 01:18:26 -0500

updated 2012-12-03 01:31:37 -0500

The bag file you are using has "holes" of ~0.5s in it every 10-15s (see the attached rxbag timeline).

image description

It appears the outage with missing data at 45.8s leads to an error of the scanmatcher of hector_mapping. The robot is rotating pretty fast at that time, which makes it hard to recover from this. It might be possible to fix this error with parameter tuning, but a bagfile without data outages will probably also work better (given that hector_mapping works well in the first 45s of the bagfile, even despite the erroneous bagfile).

edit flag offensive delete link more


We need it that for hard drive savings. So This bag file should remain as it is. Any help on tuning the parameters?? Which parameters should be tuned??

Astronaut gravatar image Astronaut  ( 2012-12-03 17:39:56 -0500 )edit

You need outages of 0.5s very 10-15s for hard drive savings? That doesn't make any sense. You can play around with the map resolution, the map resolution levels and the map_update_thresh parameters. In the end a non-broken logfile would make much more sense, though.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-12-03 19:12:09 -0500 )edit

Well the main point is that at the moment I can use the bag file that we have here at the institute. I have to find the way to improve the accuracy of estimated robot pose with the bag file we have. So hector mapping can not deal with this kind of bag files??

Astronaut gravatar image Astronaut  ( 2012-12-03 19:36:08 -0500 )edit

There are probably ways to work around it, but unfortunately I don't have the time to work on making hector_mapping work with essentially broken bag files. The outages in the bagfile could also present problems to other approaches, but you'd have to try that.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-12-03 20:58:21 -0500 )edit

so basicly have to tune map parameters, right??

Astronaut gravatar image Astronaut  ( 2012-12-03 22:42:17 -0500 )edit

It might work with parameter tuning, but there's no guarantees. How does the gmapping/laser_scan_matcher option work?

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-12-04 19:11:20 -0500 )edit

Your comments about the outages data in the bag file does not make sense. In your publish paper for hector mapping, it suppose to work fine in rescue robot where the environments is complicated. In this environment is normal to have bag file with outages of data. So how is to explain that?

Astronaut gravatar image Astronaut  ( 2012-12-04 19:15:50 -0500 )edit

I have to check that. Where to find this option of gmapping/laser_scan_matcher??

Astronaut gravatar image Astronaut  ( 2012-12-04 19:16:35 -0500 )edit

answered 2012-12-02 17:03:50 -0500

Mac gravatar image

In short, SLAM is a hard problem. If I recall correctly, Hector is a scan-matching-only system, without any loop closure; as a result, small errors (which are guaranteed to take place) will pile up. The worse your prior (that is, the worse your odometry/IMU data), the harder this is going to be.

If you're running a bag data, trying going back to a robot: see if driving more slowly fixes it, for example.

edit flag offensive delete link more


At the moment can not go back to the robot. I can not not drive it more slowly as I have to record another bag file. I can play only the existing bag files at the moment. The problem is that it was running perfectly at the beginning with the same bag file and the same robot. Im bit confuse

Astronaut gravatar image Astronaut  ( 2012-12-02 17:13:34 -0500 )edit

Can you upload the bag file somewhere?

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-12-02 21:22:49 -0500 )edit
Astronaut gravatar image Astronaut  ( 2012-12-02 22:49:30 -0500 )edit

Any help??

Astronaut gravatar image Astronaut  ( 2012-12-02 22:49:54 -0500 )edit

Please refrain from begging for help. People will look into your problems if they want to and can find the time. Especially, given that Stefan reviewed your bag-file within 2-3 hours, which is an excellent response time!

dornhege gravatar image dornhege  ( 2012-12-03 01:58:48 -0500 )edit

Ok. Just wonted to comment that I find the way to fix the problem , tuning the map resolution parameters. But I do not have clear if that impact the performance of the localizer. I mean tuning the map resolution parameters and get better scan matching does it means a more accurate pose estimation??

Astronaut gravatar image Astronaut  ( 2012-12-05 20:09:28 -0500 )edit

Which resolution did end up working? The accuracy is of course also a function of map resolution. You should have some way of testing if the system is accurate enough for you.

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2012-12-06 01:31:58 -0500 )edit

So It works with map_resolution default value of 0.025, map_update_distance_thresh =0.1, map_update_angle_thresh = 0.1, and map_multi_res_levels =4. So how will this affect the pose estimation?

Astronaut gravatar image Astronaut  ( 2012-12-06 11:05:27 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2012-12-02 13:22:42 -0500

Seen: 1,799 times

Last updated: Dec 03 '12