Robot SLAM and autonomous navigation (4)-navigation function package

Robot SLAM and autonomous navigation (4)-navigation function package

1. Navigation framework

The key to navigation is robot positioning and path planning.

  • move_base: Realize optimal path planning in robot navigation
  • amcl: Realize robot positioning
    in two -dimensional maps Based on the above two functional packages, ROS provides a series of complete navigation frameworks:
    Insert picture description here

The robot releases the necessary sensor information and the target position of the navigation, and ROS can complete the navigation function. In this framework, the move_base function package provides the main operating and interactive interface for navigation. The amcl function package guarantees the accuracy of the path and accurately locates where you are.
1) First, the navigation function package collects the sensor information of the robot to achieve the effect of real-time obstacle avoidance. The robot publishes sensor_msgs/LaserScan or 3D point cloud information through ROS.
2) Secondly, the navigation function package publishes the odometer information in nav_msgs/Odometry format, and at the same time publishes the corresponding TF transformation.
3) Finally, the output of the navigation function package is geometry_msgs/Twist format control commands, and the robot completes tasks through these commands.
There are many functional packages included in the navigation framework, which can be installed directly using the following command:

sudo apt-get install ros-kinetic-navigation

Two, move_base function package

Path planning mainly consists of the following two planners:

  • Global path planning (global_planner): According to the given target location and global map for overall path planning. In navigation, use Ditesco or A* algorithm to plan the global path and calculate the best path.
  • Local implementation planning (local_planner): In actual situations, due to possible obstacles, it is impossible to perfectly follow the global path planning. Local implementation planning is implemented by the local_planner module, using the Dynamic Window Approaches algorithm to search for multiple paths to avoid obstacles, comprehensive evaluation criteria (whether to hit the obstacle, the time required), select the optimal path, and calculate the linear speed in the driving cycle And angular velocity to avoid collisions with dynamic obstacles.

1. Topics and services

Insert picture description here

2. Parameter configuration

Insert picture description here

Three, amcl function package

Autonomous positioning: The robot can calculate its position on the map in any state.
ROS provides an adaptive (or kld sampling) Monte Carlo localization method (amcl), which is a probabilistic statistical method that uses a particle filter to track a robot's posture against an existing map.

1. Topics and services

Insert picture description here

2. Parameter configuration

Overall filter parameters
Insert picture description here
Laser parameter model
Insert picture description here
Odometer model parameters
Insert picture description here

3. Coordinate transformation

Odometer can help robot positioning, and amcl can also realize robot positioning, but there are differences between the two:
Insert picture description here

  • Odometer positioning: only use the odometer data to process the TF conversion between /base and /odom
  • amcl positioning: it can estimate the pose information of the robot in the map coordinate system/map, and provide TF conversion between /base, /odom, and /map

Fourth, the configuration of the cost map

The navigation map uses two cost maps to store obstacle information in the surrounding environment:

  • Global path planning-cost map (global_costmap)
  • Local path planning and real-time obstacle avoidance (local_costmap)
    two cost maps need to use some common or independent configuration files: common configuration files, global planning configuration files, and local planning configuration files.

1. General configuration file

The cost map is used to store the obstacle information of the surrounding environment, which needs to declare the robot sensor message that the map pays attention to in order to update the map information. For the common configuration selection of the two costmaps, create a configuration file named costmap_common_params.yaml, which is parsed as follows:

#这两个参数用来设置代价地图中障碍物的相关阀值
obstacle_range: 2.5#用来设置障碍物的最大范围,若设置为2.5,则表在2.5m范围内检测到的障碍信息才会在地图中更新
raytrace_range: 3.0#用来设置检测自由空间的最大范围,设置为3,.0,表示在3m的范围内机器人将根据传感器的信息清楚范围内的自由空间
 
 
#footprint: [[0.175, 0.175], [0.175, -0.175], [-0.175, -0.175], [-0.175, 0.175]]
#footprint_inflation: 0.01
robot_radius: 0.175
inflation_radius: 0.1#这个是机器人和障碍物保持的最小安全距离为0.1m以上
#这个footprint参数设置机器人在二维地图上的占用的面积,参数以机器人的中心作为坐标原点
#要是机器人外形是圆形,则需要设置机器人的外形半径robot_radius
 
 
max_obstacle_height: 0.6
min_obstacle_height: 0.0
#这两个参数描述障碍物的最大高度和最小高度
 
observation_sources: scan#这里以激光雷达为例
scan: {
    
    data_type: LaserScan, topic: /scan, marking: true, clearing: true, expected_update_rate: 0}
#observation_sources参数列出了代价地图需要关注的所有的传感器信息,每个传感器信息都会在后面列出来
#data_type表示激光数据或者是点云数据使用的消息
#topic:表示传感器发布的话题的名称
#marking和clearing:表示是否需要使用传感器的实时信息来添加或清除代价地图中的障碍物信息

2. Global planning configuration file

The global planning configuration file is used to store the parameters for configuring the global cost map, named global_costmap_params.yaml, the code is explained in detail:

global_costmap:
   global_frame: map 
#用来表示全局代价地图需要在哪个参考系下运行,这里选择了map参考系
 
   robot_base_frame: base_footprint 
#参数用来表示代价地图可以参考的机器人本体的坐标系
 
   update_frequency: 1.0
#参数用来决定全局地图信息更新的频率,单位是Hz
 
   publish_frequency: 1.0
 
   static_map: true
#参数用来决定代价地图是否需要根据map_server提供的地图信息进行初始化,如果不需要使用已有的地图这最好设置为false
 
   rolling_window: false
   resolution: 0.01#分辨率
   transform_tolerance: 1.0#转换容忍
   map_type: costmap#地图类型

3. Local planning configuration file

The local planning configuration file is used to store the configuration parameters of the cost map, named local_costmap_params.yaml, the code is explained in detail as follows:

local_costmap:
    #下面的这几个参数和全局规划配置文件中的参数相同
   global_frame: map
   robot_base_frame: base_footprint
   update_frequency: 3.0
   publish_frequency: 1.0#参数用于设置代价地图发布可视化信息的频率,单位是Hz
   static_map: true
 
   rolling_window: false
#参数是用来设置在机器人移动过程中是否可以需要滚动窗口以保持机器人在中心位置
 
   width: 6.0
   height: 6.0
   resolution: 0.01
#这三个参数分别设置代价地图的长(米)高(米)和分辨率(米/格)虽然分辨率设置和静态地图的不同,但是一般条件下是相同的
 
   transform_tolerance: 1.0

Five, local planner configuration

The main function of the local planner base_local_planner is to calculate the speed control instructions issued to the robot according to the planned global path.
The plan configures the relevant parameters according to the specifications of the robot, and creates a configuration file named base_local_planner_params.yaml, the code is as follows:

controller_frequency: 3.0#控制频率
recovery_behavior_enabled: false
clearing_rotation_allowed: false
 
TrajectoryPlannerROS:#声明机器人本地规划采用Trajectory Rollout算法
#下面是设置算法需要用到的机器人的速度、加速度阀值等参数
   max_vel_x: 0.5
   min_vel_x: 0.1
   max_vel_y: 0.0  # zero for a differential drive robot(0是为差动机器人设置的)
   min_vel_y: 0.0
   max_vel_theta: 1.0
   min_vel_theta: -1.0
   min_in_place_vel_theta: 0.4
   escape_vel: -0.1
   acc_lim_x: 1.5
   acc_lim_y: 0.0  # zero for a differential drive robot(0是为差动机器人设置的)
   acc_lim_theta: 1.2
 
   holonomic_robot: false
   yaw_goal_tolerance: 0.1 # about 6 degrees(偏航的角度容忍度大约是6°)
   xy_goal_tolerance: 0.05  # 5 cm
   latch_xy_goal_tolerance: false
   pdist_scale: 0.4
   gdist_scale: 0.8
   meter_scoring: true
 
   heading_lookahead: 0.325
   heading_scoring: false
   heading_scoring_timestep: 0.8
   occdist_scale: 0.05
   oscillation_reset_dist: 0.05
   publish_cost_grid_pc: false
   prune_plan: true
 
   sim_time: 1.0
   sim_granularity: 0.05
   angular_sim_granularity: 0.1
   vx_samples: 8
   vy_samples: 0  # zero for a differential drive robot
   vtheta_samples: 20
   dwa: true
   simple_attractor: false

Guess you like

Origin blog.csdn.net/weixin_45661757/article/details/114044963