ROS are used to build a map SLAM

Package installation gmapping

Before using gmapping, we need to be installed with the following command gmapping:

$ sudo apt install ros-melodic-gmapping

ROS gmapping SLAM algorithm is an open source software package, the package contains a node named slam_gmapping, that SLAM algorithm.

The package using laser scanning data and construct a mobile robot positioning aid occupying 2D grid map.

 

Gmapping create a boot file for the main task when creating boot file for the gmapping is to set the appropriate parameters for the slam_gmapping move_base nodes and nodes.

slam_gmapping node is a core node ROS gmapping software package, slam_gmapping node subscription laser data

(Sensor_msgs / LaserScan) and tf data, and will occupy a raster map data as output (nav_msgs / OccupancyGrid) release.

The node is highly configurable, and we can fine-tune the parameters to improve map accuracy of these parameters is available online at http: //

wiki.ros.org/gmapping in view.

Then we have another node to node configuration is move_base, we need to configure the main parameters is the cost of global and local map parameters,

Local planning and move_base parameters, the list is long, so I was in several YAML file to represent these parameters, these parameters

param files are included in the package diff_wheeled_robot_gazebo folder.

Here is gmapping.launch file using the robot, the startup file stored in diff_wheeled_robot_gazebo / launch folder:

 

 1 <launch>                                                                            
 2   <arg name="scan_topic" default="scan" />
 3 
 4   <node pkg="gmapping" type="slam_gmapping" name="slam_gmapping" output="screen">
 5     <param name="base_frame" value="base_footprint"/>
 6     <param name="odom_frame" value="odom"/>
 7     <param name="map_update_interval" value="5.0"/>
 8     <param name="maxUrange" value="6.0"/>
 9     <param name="maxRange" value="8.0"/>
10     <param name="sigma" value="0.05"/>
11     <param name="kernelSize" value="1"/>
12     <param name="lstep" value="0.05"/>
13     <param name="astep" value="0.05"/>
14     <param name="iterations" value="5"/>
15     <param name="lsigma" value="0.075"/>
16     <param name="ogain" value="3.0"/>
17     <param name="lskip" value="0"/>
18     <param name="minimumScore" value="100"/>
19     <param name="srr" value="0.01"/>
20     <param name="srt" value="0.02"/>
21     <param name="str" value="0.01"/>
22     <param name="stt" value="0.02"/>
23     <param name="linearUpdate" value="0.5"/>
24     <param name="angularUpdate" value="0.436"/>
25     <param name="temporalUpdate" value="-1.0"/>
26     <param name="resampleThreshold" value="0.5"/>
27     <param name="particles" value="80"/>
28   <!--
29     <param name="xmin" value="-50.0"/>
30     <param name="ymin" value="-50.0"/>
31     <param name="xmax" value="50.0"/>
32     <param name="ymax" value="50.0"/>
33   make the starting size small for the benefit of the Android client's memory...
34   -->
35     <param name="xmin" value="-1.0"/>
36     <param name="ymin" value="-1.0"/>
37     <param name="xmax" value="1.0"/>
38     <param name="ymax" value="1.0"/>
39 
40     <param name="delta" value="0.05"/>
41     <param name="llsamplerange" value="0.01"/>
42     <param name="llsamplestep" value="0.01"/>
43     <param name="lasamplerange" value="0.005"/>
44     <param name="lasamplestep" value="0.005"/>
45     <remap from="scan" to="$(arg scan_topic)"/>
46   </node>
47 
48 
49 
50   <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="sc   reen">
51     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/costmap_common_params.ya   ml" command="load" ns="global_costmap" />
52     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/costmap_common_params.ya   ml" command="load" ns="local_costmap" />
53     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/local_costmap_params.yam   l" command="load" />
54     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/global_costmap_params.ya   ml" command="load" />
55     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/base_local_planner_param   s.yaml" command="load" />
56     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/dwa_local_planner_params   .yaml" command="load" />
57     <rosparam file="$(find diff_wheeled_robot_gazebo)/param/move_base_params.yaml" c   ommand="load" />
58 
59 <!--    <remap from="cmd_vel" to="navigation_velocity_smoother/raw_cmd_vel"/>
60     <remap from="odom" to="$(arg odom_topic)"/> -->
61   </node>
62 
63 </launch>                                   

 

 

Running on a differential drive robot SLAM

In order to build a map, we need to compile the ROS package: diff_wheeled_robot_gazebo, and run the startup file gmapping.launch

 

 

 

 

Guess you like

Origin www.cnblogs.com/tanshengjiang/p/12331566.html