6.gmapping mapping algorithm

Gmapping: http://wiki.ros.org/gmapping/

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

6.1 Introduction

Advantages: Gmapping can build indoor maps in real time, requiring less computation and higher accuracy in building small scene maps.

Disadvantage: As the scene grows, the number of particles required increases, because each particle carries a map, so the memory and computation required to build a large map will increase. Therefore, it is not suitable for building large scene maps. And there is no loopback detection, so the map may be dislocated when the loopback is closed. Although increasing the number of particles can make the map closed, it comes at the cost of increasing computation and memory.

image-20220224141102272

6.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

6.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-20220224143306896

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].

6.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.

6.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:

6.2 Topics and Services

Subscribe to topicstypedescribe
tftf/tfMessageUsed to convert between lidar coordinate system, base coordinate system, and odometer coordinate system
scansensor_msgs/LaserScanLidar scan data
Post a topictypedescribe
map_metadatanav_msgs/MapMetaDataPublish map Meta data
mapnav_msgs/OccupancyGridPublish map raster data
~entropystd_msgs/Float64Publish an estimate of the robot pose distribution entropy
Servetypedescribe
dynamic_mapnav_msgs/GetMapGet map data

Node view

image-20220224141102272

6.3 configuration parameters

parametertypeDefaultsdescribe
~throttle_scansint1After receiving the laser data of this number of frames, only one frame of data is processed. By default, it is processed every time a frame of data is received.
~base_framestring"base_link"Robot base coordinate system
~map_framestring"map"map coordinate system
~odom_framestring"odom"Odometer Coordinate System
~map_update_intervalfloat5.0The map update frequency, the lower the value, the greater the computational load
~maxUrangefloat80.0The maximum range that the laser can detect
~sigmafloat0.05Standard Deviation of Endpoint Match
~kernelSizeint1Find in the corresponding kernel
~lstepfloat0.05Optimization step size during translation
~astepfloat0.05Optimization step size during rotation
~iterationsint5The number of iterations to scan for matches
~lsigmafloat0.075Laser Standard Deviation for Likelihood Calculations
~ ogainfloat3.0Used to smooth the resampling effect when calculating the likelihood
~ lskipint0Number of beams skipped per scan
~ minimumScorefloat0Scan the lowest value for matching results. Avoid jumping pose estimation in large open spaces when using laser scanners with limited range(e.g. 5m)
~srrfloat0.1translation function(rho/rho), odometer error while translation
~srtfloat0.2Rotation function(rho/theta), odometry error in translation
~strfloat0.1Translation function(theta/rho), odometry error while rotating
~sttfloat0.2Rotation function(theta/theta), odometer error while rotating
~linearUpdatefloat1.0After the robot translates this distance, the laser scan data is processed once
~angularUpdatefloat0.5The laser scan data is processed every time the robot rotates this distance
~temporalUpdatefloat-1.0If the latest scan is being processed slower than the update, then a scan is processed. A negative value turns off time-based updates
~resampleThresholdfloat0.5Resampling threshold based on Neff
~particlesint30number of particles in the filter
~xminfloat-100.0map x to initial minimum size
~yminfloat-100.0Map y to initial minimum size
~xmaxfloat100.0map x to initial maximum size
~ymaxfloat100.0The initial maximum size of the map y direction
~deltafloat0.05map resolution
~llsamplerangefloat0.01Shifted sampling distance for likelihood calculation
~llsamplestepfloat0.01Shifted sampling step size for likelihood calculation
~lasamplerangefloat0.005Rotation sampling distance for likelihood calculation
~lasamplestepfloat0.005Rotation sampling step size for likelihood calculation
~transform_publish_periodfloat0.05The time interval at which the TF transform is published
~occ_threhfloat0.25Threshold for raster map occupancy
~maxRange(float)float-maximum range of the sensor

6.4 TF transformation

Required TF Transformdescribe
laser-->base_linkThe transformation between the lidar coordinate system and the base coordinate system, generally published by robot_state_publisher or static_transform_publisher
base_link-->odomThe transformation between the map coordinate system and the robot's odometer coordinate system to estimate the robot's pose in the map
Published TF Transformdescribe
map-->odomThe transformation between the map coordinate system and the robot's odometer coordinate system to estimate the robot's pose in the map

View tf tree

image-20220224141102272