ROS-based slam map construction and navigation autonomous navigation

ROS-based slam map construction and navigation autonomous navigation

One, slam map construction

1. Experimental principle
1.1 Installation of slam algorithm
ros-indigo-slam-gmapping is one of the laser slam algorithms of the ros platform. This algorithm must be installed before using the LIAOKE robot for map construction. Terminal input command:
$ sudo apt-get install ros-indigo-slam-gmapping to install the slam algorithm;

1.2 Program package
Program package location: /LIAOKE_ws/src/LIAOKE_map.

1.3 Node communication diagram
1.3 Node communication diagram

2. Experimental steps
2.1 Hardware check
Insert the handle usb interface, terminal input:
$ ls /dev/input/
shows js0 ​​to indicate that the system has recognized the handle, as shown in the figure;
Enter information group
input: $ sudo jstest /dev/input/js0 to
check whether the handle is running Normal, the handle is operating normally as follows;
Insert picture description here

2.2 Start gmapping node
New terminal input: $ roslaunch LIAOKE_map LIAOKE_gmapping. The launch
window displays the rviz interface, use the handle to control LIAOKE to move in the indoor environment, and get a two-dimensional map as shown in the figure. There are LIAOKE car body model and related information scanned by radar on the interface;

Insert picture description here
2.3 Save the map
Open a new terminal and enter the following command: first switch to the directory where the map is saved:
cd ~/LIAOKE/LIAOKE_map/maps

Then run the following command to save the map:
rosrun map_server map_saver –f map

Two, navigation autonomous navigation

1. Experimental principle
1.1 Program package
LIAOKE robot navigation algorithm implementation package is LIAOKE_nav, the location of the package:
/LIAOKE_ws/src/LIAOKE_nav.

1.2 Navigation package layout diagram
Before proceeding with the experiment, you need to make sure that the navigation package set has been installed in the system. The terminal input: sudo apt-get install ros-indigo-navigation to install the navigation package. The layout of the navigation package is shown in the figure.
Insert picture description here
Configure the robot, and the navigation function package will make it move. The figure above outlines this configuration.
The white parts are required and implemented components, the gray parts are optional and implemented components, and the blue parts are components that must be created for each robot platform. The following content will introduce the prerequisites for using the navigation package set:

(1) TF transformation configuration (other transformations)
navigation function package set requires the robot to continuously use tf to publish information about the relationship between coordinate systems.

(2) The sensor source
navigation function package uses information from sensors to avoid obstacles in the real environment. It assumes that these sensors continuously publish sensor_msgs/LaserScan messages or sensor_msgs/PointCloud messages on ROS.

(3) The mileage information (odometry source)
navigation function package set needs to use the mileage information published by tf and nav_msgs/Odometry messages.

(4) The base controller
navigation function package assumes that it can publish geometry_msgs/Twist type messages through the topic "cmd_vel". This message is based on the robot's base coordinate system and it transmits motion commands. This means that a node must subscribe to the "cmd_vel" topic, and send the speed commands (vx, vy, vtheta) on the topic into motor commands (cmd_vel.linear.x, cmd_vel.linear.y, cmd_vel.angular.z) Give the mobile base.

(5) The map server (map_server)
publishes the cost map as a ROS Service and provides a map_saver node, which can store the map through the command line.

1.3 Node communication diagram
Insert picture description here
1.4 amcl node analysis
Monte Carlo positioning node amcl: amcl node inputs laser map, laser scan, and tf conversion information, and outputs pose estimation. Amcl completes the initialization of the particle filter according to the provided parameters at startup.

(1) Subscribe to topics:
coordinate conversion information/tf(tf/tfMessage)
navigation map information/map(nav_msgs/OccupancyGrid)
initial pose/initialpose(geometry_msgs/PoseWithCovarianceStamped)
laser scanning/scan(sensor_msgs/LaserScan)

(2) Post topic:
pose estimation/amcl_pose(geometry_msgs/PoseWithCovarianceStamped) the pose estimation collection maintained by the particle filter/particlecloud(geometry_msgs/PoseArray) coordinate conversion information/tf(tf/tfMessage)

(3) Service: global_localization (std_srvs/Empty), used to start global positioning, in which all particles randomly scattered through the free space in the map.

2. Test steps
Terminal input command: $ roscore to run a master;
terminal input: $ roslaunch LIAOKE_nav LIAOKE_nav.launch The map in the gmapping package appears on the pop-up rviz, as shown in the figure;
Insert picture description here
for accurate navigation, first give the initial position of the robot , Use "2D Pose Estimate" in the menu bar to give the actual position of the robot on the map.

Then click on the 2D Nav Goal in the upper row, mark the arrow at any position in the figure, and give the target position of the robot, and the robot will automatically plan the path to move to the arrow position.
Insert picture description here
Navigation autonomous navigation can be realized through the path planning algorithm as shown in the figure.

Guess you like

Origin blog.csdn.net/qq_45252077/article/details/107881266