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
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.
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.
Turn off the automatic chassis service
sudo supervisorctl stop ChassisServer
Start chassis driver command (robot side)
x
sudo supervisorctl re LaserServer #start/stop Switch radar service (indoor version)
roslaunch scout_bringup scout_mini_robot_base.launch # laser + yahboom
rostopic echo /scan
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)
xxxxxxxxxx
roslaunch yahboom_navrobo_nav yahboom_navrobo_map.launch use_rviz:=false map_type:=hector
Open the visualization interface (robot side)
xxxxxxxxxx
roslaunch yahboom_navrobo_nav view_map.launch
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].
xxxxxxxxxx
roslaunch yahboom_navrobo_ctrl yahboom_keyboard.launch # Custom
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.
xxxxxxxxxx
# The first method
rosrun map_server map_saver -f /home/yahboom/YBAMR-COBOT-EDU-00001/src/yahboom_navrobo_nav/maps/my_map
# The second method
bash /home/yahboom/YBAMR-COBOT-EDU-00001/src/yahboom_navrobo_nav/maps/map.sh
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
xxxxxxxxxx
image: mymap.pgm
resolution: 0.05
origin: [-15.4,-12.2,0.0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.196
Parameter analysis:
Topic Subscription | Type | Description |
---|---|---|
scan | sensor_msgs/LaserScan | Depth data scanned by the laser radar |
syscommand | std_msgs/String | System command. If the string equals "reset", the map and robot pose are reset to the initial state |
Topic Publish | Type | Description |
map_metadata | nav_msgs/MapMetaData | Publish map meta data |
map | nav_msgs/OccupancyGrid | Publish map grid data |
slam_out_pose | geometry_msgs/PoseStamped | Robot pose estimation without covariance |
poseupdate | geometry_msgs /PoseWithCovarianceStamped | Robot pose estimation with Gaussian uncertainty estimation |
Service | Type | Description |
dynamic_map | nav_msgs/GetMap | Get map data |
reset_map | std_srvs/Trigger | Call 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_mapping | std_srvs/SetBool | Call this service to stop/start processing the laser scan. |
restart_mapping_with_new_pose | hector_mapping/ResetMapping | Call this service to reset the map, robot pose, and restore the map (if paused) |
Node View
xxxxxxxxxx
rqt_graph
Parameter | Type | Default Value | Description |
---|---|---|---|
~base_frame | String | "base_link" | Robot base coordinate system, used for positioning and laser scanning data transformation |
~map_frame | String | "map" | Map coordinate system |
~odom_frame | string | "odom" | Odometer coordinate system (essentially the coordinate system pointed to by map) |
~map_resolution | Double | 0.025(m) | Map resolution, edge length of grid unit |
~map_size | Int | 1024 | Map size |
~map_start_x | double | 0.5 | /map origin [0.0, 1.0] relative to the grid map on the x-axis |
~map_start_y | double | 0.5 | /map origin [0.0, 1.0] relative to the grid map on the y-axis |
~map_update_distance_thresh | double | 0.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_thresh | double | 0.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_period | double | 2.0 | Map publishing period |
~map_multi_res_levels | int | 3 | Map multi-resolution grid levels |
~update_factor_free | double | 0.4 | Used to update the map of free cells, the range is [0.0, 1.0] |
~update_factor_occupied | double | 0.9 | Used to update the map of occupied cells, the range is [0.0, 1.0] |
~laser_min_dist | double | 0.4(m) | The minimum distance of the laser scan point, scan points less than this value will be ignored |
~laser_max_dist | double | 30.0(m) | The maximum distance of the laser scan point, scan points less than this value will be ignored |
~laser_z_min_value | double | -1.0(m) | Relative to the minimum height of the laser radar, scan points below this value will be ignored |
~laser_z_max_value | double | 1.0(m) | Relative to the maximum height of the laser radar, scan points above this value will be ignored |
~pub_map_odom_transform | bool | true | Whether to publish the coordinate transformation between map and odom |
~output_timing | bool | false | Process the output timing information of each laser scan through ROS_INFO |
~scan_subscrible_queue_size | int | 5 | The queue size of the scan subscriber |
~pub_map_scanmatch_transform | bool | true | Whether to publish the coordinate transformation between scanmatcher and map |
~tf_map_scanmatch_transform_frame_name | String | "scanmatcher_frame" | Scanmatcher coordinate system name |
Required TF transformation | Description |
---|---|
laser-->base_link | Usually 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 transformation | Description |
map-->odom | The current estimate of the robot pose in the map frame (only provided when the parameter "pub_map_odom_transform" is true). |
View tf tree
xxxxxxxxxx
rosrun rqt_tf_tree rqt_tf_tree