7.hector mapping algorithm

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

7.1 Introduction

Features: hector_slam does not need to subscribe to odometer/odom messages, uses the Gauss-Newton method, and directly estimates odometer information using lidar. However, when the speed of the robot is high, slippage will occur, resulting in deviations in the mapping effect and high requirements for sensors. When building a map, set the rotation speed of the cart as low as possible.

There is no odom coordinate system usage method, taken from Wiki.

image-20220224144154123

7.2 Use

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

According to different models, you only need to set the purchased model in [.bashrc], X1(ordinary four-wheel drive) X3(Mike wheel) X3plus(Mike wheel mechanical arm) R2(Ackerman differential) and so on. Section takes X3 as an example

Open the [.bashrc] file

Find the [ROBOT_TYPE] parameter and modify the corresponding model

7.2.1 Start

Start command(robot side), for the convenience of operation, this section takes [mono + laser + yahboomcar] as an example.

Mapping command(robot side)

Open the visual interface(virtual machine side)

image-20220224144503635

The gap at the back of the robot is due to the occlusion of the installation position of the display screen, so a certain range of Lidar data is shielded. The shielding range can be adjusted or not shielded according to the actual situation. For details, see [01. Lidar Basic Course].

7.2.2 Control the robot

Make the robot walk all over the area to be built, and the map is as closed as possible.

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

7.2.3 Map save

The map will be saved to ~/yahboomcar_ws/src/yahboomcar_nav/maps/ folder, a pgm image, a yaml file.

map.yaml

Parameter parsing:

7.3 Topics and Services

Topic subscriptiontypedescribe
scansensor_msgs/LaserScanDepth data from lidar scans
syscommandstd_msgs/Stringsystem command. If the string is equal to "reset", the map and robot pose are reset to the initial state
Topic releasetypedescribe
map_metadatanav_msgs/MapMetaDataPublish map Meta data
mapnav_msgs/OccupancyGridPublish map raster data
slam_out_posegeometry_msgs/PoseStampedCovariance-Free Robot Pose Estimation
poseupdategeometry_msgs /PoseWithCovarianceStampedRobot Pose Estimation with Gaussian Uncertainty Estimation
Servetypedescribe
dynamic_mapnav_msgs/GetMapGet map data
reset_mapstd_srvs/TriggerCall this service to reset the map and the 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 laser scans.
restart_mapping_with_new_posehector_mapping/ResetMappingCall this service to reset the map, the robot's pose, and resume the map(if paused)

Node view

image-20220224144503635

7.4 configuration parameters

parametertypeDefaultsdescribe
~base_frameString"base_link"Robot base coordinate system for positioning and transformation of laser scan data
~map_frameString"map"The coordinate system of the map
~odom_framestring"odom"Odometer coordinate system(essentially the coordinate system pointed to by map)
~map_resolutionDouble0.025(m)map resolution, edge length of grid cells
~map_sizeInt1024the size of the map
~map_start_xdouble0.5The origin of /map [0.0, 1.0] is relative to the grid map on the x-axis
~map_start_ydouble0.5The origin of /map [0.0, 1.0] is relative to the grid map on the y-axis
~map_update_distance_threshdouble0.4(m)The threshold for map update, which is calculated from the first update on the map until the straight distance reaches the parameter value and is updated again
~map_update_angle_threshdouble0.9(rad)The threshold for map update, which is calculated from one update on the map until the rotation reaches this parameter value and then update again
~map_pub_perioddouble2.0map release cycle
~map_multi_res_levelsint3Map Multi-Resolution Grid Series
~update_factor_freedouble0.4The map used to update free cells, the range is [0.0, 1.0]
~update_factor_occupieddouble0.9The map used to update the occupied cells, the range is [0.0, 1.0]
~laser_min_distdouble0.4(m)The minimum distance of the laser scan point, the scan point less than this value will be ignored
~laser_max_distdouble30.0(m)The maximum distance of the laser scan point, the scan point less than this value will be ignored
~laser_z_min_valuedouble-1.0(m)The minimum height relative to the lidar, scan points below this value will be ignored
~laser_z_max_valuedouble1.0(m)Relative to the lidar's maximum height, scan points above this value will be ignored
~pub_map_odom_transformbooltrueWhether to publish the coordinate conversion between map and odom
~output_timingboolfalseProcess the output timing information of each laser scan through ROS_INFO
~scan_subscrible_queue_sizeint5Queue size for scan subscribers
~pub_map_scanmatch_transformbooltrueWhether to publish the coordinate transformation between scanmatcher and map
~tf_map_scanmatch_transform_frame_nameString"scanmatcher_frame"Scanmatcher's coordinate system naming

7.5 TF transformation

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

View tf tree

image-20220224144503635