6. Hector Mapping Algorithm

6. Hector Mapping Algorithm6.1. Introduction6.2. Use6.2.1. Startup6.2.2, Control the robot6.2.3, Map Saving6.3. Topics and Services6.4, Configuration Parameters6.5, TF transformation

hector_slam: http://wiki.ros.org/hector_slam

hector_slam/Tutorials: http://wiki.ros.org/hector_slam/Tutorials/SettingUpForYourRobot

hector_mapping: http://wiki.ros.org/hector_mapping

map_server: https://wiki.ros.org/map_server

6.1. Introduction

Features: hector_slam does not need to subscribe to odometer/odom messages, uses Gauss-Newton method, and directly uses lidar to estimate odometer information. However, when the robot is fast, it will slip, resulting in deviations in the mapping effect, and high requirements for sensors. When building a map, try to adjust the car's rotation speed to a lower level.

There is no method for using the odom coordinate system, excerpted from Wiki.

image-20220224144154123

6.2. Use

Note: When building a map, the slower the speed, the better the effect (note that the rotation speed should be slower). If the speed is too fast, the effect will be very poor.

6.2.1. Startup

Turn off the automatic chassis service

Start chassis driver command (robot side)

and the print is empty and the data cannot be obtained, the startup is abnormal. Please restart the radar service command.

Mapping command (robot side)

Open the visualization interface (robot side)

image-20240627111502356

The robot blocks a certain range of radar data. The blocking range can be adjusted or not blocked according to the actual situation. For specific operations, see [01. Radar Basic Course].

6.2.2, Control the robot

Make the robot walk through the area to be mapped and make the map as closed as possible.

There may be some scattered points during the mapping process. If the mapping environment is well closed, regular, and moves slowly, the scattering phenomenon will be much smaller.

6.2.3, Map Saving

The map will be saved to the /home/yahboom/YBAMR-COBOT-EDU-00001/src/yahboom_navrobo_nav/maps/ folder, a pgm picture, a yaml file.

mymap.yaml

Parameter analysis:

6.3. Topics and Services

Topic SubscriptionTypeDescription
scansensor_msgs/LaserScanDepth data scanned by the laser radar
syscommandstd_msgs/StringSystem command. If the string equals "reset", the map and robot pose are reset to the initial state
Topic PublishTypeDescription
map_metadatanav_msgs/MapMetaDataPublish map meta data
mapnav_msgs/OccupancyGridPublish map grid data
slam_out_posegeometry_msgs/PoseStampedRobot pose estimation without covariance
poseupdategeometry_msgs
/PoseWithCovarianceStamped
Robot pose estimation with Gaussian uncertainty estimation
ServiceTypeDescription
dynamic_mapnav_msgs/GetMapGet map data
reset_mapstd_srvs/TriggerCall this service to reset the map, hector will create a brand new map from scratch. Note that this will not restart the robot's pose, it will restart from the last recorded pose.
pause_mappingstd_srvs/SetBoolCall this service to stop/start processing the laser scan.
restart_mapping_with_new_posehector_mapping/ResetMappingCall this service to reset the map, robot pose, and restore the map (if paused)

Node View

hectorrosgraph

6.4, Configuration Parameters

ParameterTypeDefault ValueDescription
~base_frameString"base_link"Robot base coordinate system, used for positioning and laser scanning data transformation
~map_frameString"map"Map coordinate system
~odom_framestring"odom"Odometer coordinate system (essentially the coordinate system pointed to by map)
~map_resolutionDouble0.025(m)Map resolution, edge length of grid unit
~map_sizeInt1024Map size
~map_start_xdouble0.5/map origin [0.0, 1.0] relative to the grid map on the x-axis
~map_start_ydouble0.5/map origin [0.0, 1.0] relative to the grid map on the y-axis
~map_update_distance_threshdouble0.4(m)Map update threshold, from the start of an update to the straight distance reaching this parameter value on the map, update again
~map_update_angle_threshdouble0.9(rad)Map update threshold, from the start of an update to the rotation reaching this parameter value on the map, update again
~map_pub_perioddouble2.0Map publishing period
~map_multi_res_levelsint3Map multi-resolution grid levels
~update_factor_freedouble0.4Used to update the map of free cells, the range is [0.0, 1.0]
~update_factor_occupieddouble0.9Used to update the map of occupied cells, the range is [0.0, 1.0]
~laser_min_distdouble0.4(m)The minimum distance of the laser scan point, scan points less than this value will be ignored
~laser_max_distdouble30.0(m)The maximum distance of the laser scan point, scan points less than this value will be ignored
~laser_z_min_valuedouble-1.0(m)Relative to the minimum height of the laser radar, scan points below this value will be ignored
~laser_z_max_valuedouble1.0(m)Relative to the maximum height of the laser radar, scan points above this value will be ignored
~pub_map_odom_transformbooltrueWhether to publish the coordinate transformation between map and odom
~output_timingboolfalseProcess the output timing information of each laser scan through ROS_INFO
~scan_subscrible_queue_sizeint5The queue size of the scan subscriber
~pub_map_scanmatch_transformbooltrueWhether to publish the coordinate transformation between scanmatcher and map
~tf_map_scanmatch_transform_frame_nameString"scanmatcher_frame"Scanmatcher coordinate system name

6.5, TF transformation

Required TF transformationDescription
laser-->base_linkUsually a fixed value, the transformation between the laser radar coordinate system and the base coordinate system, generally published by robot_state_publisher or static_transform_publisher
Published TF transformationDescription
map-->odomThe current estimate of the robot pose in the map frame (only provided when the parameter "pub_map_odom_transform" is true).

View tf tree

hectorframes