Ask Your Question

Hector mapping not creating map

asked 2016-04-05 16:04:06 -0500

andythepandy93 gravatar image

updated 2016-04-06 03:05:32 -0500


I have a LIDAR connected to an AR drone, with drivers running on the drone to read the laser data, and send it to my ros master computer using netcat. I have written a ros driver in python that listens to the network and reads the incoming laser data, creates a LaserScan message, populates all the fields and then publishes this to /scan.

I can see /scan in rostopic list, and can see populated messages in rostopic echo /scan. However when I run my launch file which runs hector_mapping, no map is created. I know the launch file works as I have tested it with the LIDAR connected directly to the master computer using the official drivers and it builds a map fine.

So I think there must be a problem when I populate the LaserScan message and publish it. I have included one of my populated messages below, can anyone see anything wrong with it or suggest something else which I can try? I have noticed the seq fields in the header are always 0 but have read I shouldn't set that myself and leave ros to deal with it.

Node: /laserlistener
Time: 21:56:49.521363019 (2016-04-05)
Severity: Info
Published Topics: /rosout, /scan

  seq: 0
    secs: 1459889809
    nsecs: 520699977
  frame_id: laser
angle_min: 3.14159265359
angle_max: -3.14159265359
angle_increment: 0.0174532925199
time_increment: 0.000515921866295
scan_time: 0.18521595
range_min: 0.15
range_max: 6
ranges: [0.0, 0.0, 1274.25,  ... ] omitted as lots of numbers, all look correct though
intensities: [ ... ] ditto

The angle_min and angle_max fields are meant to be like that (at least that is what the official driver spits out) I have also tried 0 to 2*pi

Launch file:

<node pkg="tf" type="static_transform_publisher" name="map2odom" args="0 0 0 0 0 0 map odom 100" />

<node pkg="tf" type="static_transform_publisher" name="odom2base_frame" args="0 0 0 0 0 0 odom base_frame 100" />

<node pkg="tf" type="static_transform_publisher" name="base_frame2base_footprint" args="0 0 0 0 0 0 base_frame base_footprint 100" />

<node pkg="tf" type="static_transform_publisher" name="base_footprint2base_stabalized" args="0 0 0 0 0 0 base_footprint base_stabalized 100" />

<node pkg="tf" type="static_transform_publisher" name="base_stabalized2base_link" args="0 0 0 0 0 0 base_stabalized base_link 100" />

<node pkg="tf" type="static_transform_publisher" name="base_link2laser" args="0 0 0 0 0 0 base_link laser 100" />

<node pkg="tf" type="static_transform_publisher" name="map2scanmatcher_frame" args="0 0 0 0 0 0 map scanmatcher_frame 100" />

<include file="$(find hector_slam_launch)/launch/tutorial.launch"/>

<param name="use_sim_time" value="false" />

<param name="hector_mapping/pub_map_odom_transform" value="false"/>

<!-- Map size / start point -->
<param name="hector_mapping/map_resolution" value="0.050"/>
<param name="hector_mapping/map_size" value="2048"/>
<param name="hector_mapping/map_start_x" value="0.5"/>
<param name="hector_mapping/map_start_y" value="0.5" />
<param name="hector_mapping/map_multi_res_levels" value="5" />

<!-- Map update parameters -->
<param name="hector_mapping/update_factor_free" value="0.4"/>
<param name="hector_mapping/update_factor_occupied" value="0.9" />    
<param name="hector_mapping/map_update_distance_thresh" value="0.01"/>
<param name="hector_mapping/map_update_angle_thresh" value="0.06" />
<param name="hector_mapping/laser_z_min_value" value = "-1.0" />
<param ...
edit retag flag offensive close merge delete


Could you also upload your launch file? I guess it may cause by launch file connect.

YingHua gravatar imageYingHua ( 2016-04-05 22:44:43 -0500 )edit

Knew I'd forgotten something! Added launch file and he publishing node

andythepandy93 gravatar imageandythepandy93 ( 2016-04-06 03:06:06 -0500 )edit

Can you visualize the scan via rviz? Also, I saw you set the max range to be 6m but i also saw the laser scan data 1274.25. Are you sure all the laser scans have correct distances. In Hector slam, the scan will be filtered by the laser_max_dist set in launch file (4m in your case)

DavidN gravatar imageDavidN ( 2016-04-06 21:13:56 -0500 )edit

I cannot visualise with rviz, it counts up the messages coming in so is definitely receiving them. Very true, when I run it with the actual drivers all the numbers are much smaller. I will check the code and post back

andythepandy93 gravatar imageandythepandy93 ( 2016-04-07 09:21:29 -0500 )edit

Yes that was it! The numbers were in millimetres instead of meters. Thanks for the pointer

andythepandy93 gravatar imageandythepandy93 ( 2016-04-07 15:39:28 -0500 )edit

Don't know how to mark this as answered either as these are only comments to the original question

andythepandy93 gravatar imageandythepandy93 ( 2016-04-07 15:41:01 -0500 )edit

That s great. You can write your own answer of how you fixed it in the answer session.

DavidN gravatar imageDavidN ( 2016-04-07 21:31:22 -0500 )edit

I've added it, but says I need >10 points to accept my own answer

andythepandy93 gravatar imageandythepandy93 ( 2016-04-08 05:41:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-08 05:40:46 -0500

andythepandy93 gravatar image

Turns out the drivers I was using on the AR drone were giving out millimetres instead of the meters that LaserScan is expecting. After dividing the output by 1000, I get a map and pose as expected. Thank you to DavidN for pointing it out

edit flag offensive delete link more



You now have 11 points and can answer your own question :P

Icehawk101 gravatar imageIcehawk101 ( 2016-04-08 15:08:32 -0500 )edit

Ah nice, thanks

andythepandy93 gravatar imageandythepandy93 ( 2016-04-09 05:03:04 -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: 2016-04-05 16:04:06 -0500

Seen: 550 times

Last updated: Apr 08 '16