ros navigation costmap 配置进阶版
1. common configuration (global_costmap & local_costmap)
costmap_common_params.yaml
2. global configuration (global_costmap)
global_costmap_params.yaml
3. local configuration (local_costmap)
local_costmap_params.yaml
4. controller configuration
move_base_params.yaml
shutdown_costmaps: false
# 控制器频率
controller_frequency: 10.0
# 失效等待时间 10s
controller_patience: 10.0
planner_frequency: 2.0
planner_patience: 20.0
oscillation_timeout: 0.0
# 震荡距离
oscillation_distance: 0.5
recovery_behavior_enabled: false
clearing_rotation_allowed: true
ros navigation 规划器配置问题
规划器根据上面的全局地图和局部地图,需要分别配置全局规划器和局部规划器。
局部规划器
局部规划器是在全局规划器的基础上,计算机器人运行所需的线速度角速度。
base_local_planner_params.yaml
配置TrajectoryPlannerROS
TrajectoryPlannerROS:
# Robot Configuration Parameters
acc_lim_x: 10.0 # default 10
acc_lim_theta: 30.0 # default 20
max_vel_x: 0.5
min_vel_x: 0.1
max_vel_theta: 1.57 # default 1.57
min_vel_theta: -1.57 # default -1.57
min_in_place_vel_theta: 0.314
holonomic_robot: false
escape_vel: -0.5
# Goal Tolerance Parameters
yaw_goal_tolerance: 3.14 # We don't care about orientation
xy_goal_tolerance: 0.25 # default 0.25
latch_xy_goal_tolerance: false
# Forward Simulation Parameters
sim_time: 1.0 # default 2.0 ----> (xy_goal_tolerance / 2) > (min_vel_x * sim_time)
sim_granularity: 0.02
angular_sim_granularity: 0.02
vx_samples: 20 # default 6
vtheta_samples: 40
controller_frequency: 10.0
# Trajectory scoring parameters
meter_scoring: true # Whether the gdist_scale and pdist_scale parameters should assume that goal_distance and path_distance are expressed in units of meters or cells. Cells are assumed by default (false).
occdist_scale: 0.01 # The weighting for how much the controller should attempt to avoid obstacles. default 0.01
pdist_scale: 5.0 # The weighting for how much the controller should stay close to the path it was given . default 0.6, maximal possible value is 5.0
gdist_scale: 0.1 # The weighting for how much the controller should attempt to reach its local goal, also controls speed default 0.8, maximal possible value is 5.0
heading_lookahead: 0.1 #How far to look ahead in meters when scoring different in-place-rotation trajectories
heading_scoring: false #Whether to score based on the robot's heading to the path or its distance from the path. default false
heading_scoring_timestep: 0.1 #How far to look ahead in time in seconds along the simulated trajectory when using heading scoring (double, default: 0.8)
dwa: false #Whether to use the Dynamic Window Approach (DWA)_ or whether to use Trajectory Rollout
simple_attractor: false
publish_cost_grid_pc: true
#Oscillation Prevention Parameters
oscillation_reset_dist: 0.05 #How far the robot must travel in meters before oscillation flags are reset (double, default: 0.05)
escape_reset_dist: 0.1
escape_reset_theta: 0.1
dwa_local_planner_params.yaml
配置DWAPlannerROS
DWAPlannerROS:
acc_lim_th: 10
acc_lim_x: 10
acc_lim_y: 0
max_vel_x: 0.5
min_vel_x: 0.1
max_vel_y: 0.0
min_vel_y: -0.0
max_trans_vel: 2.0
min_trans_vel: 0.1
max_rot_vel: 1.0
min_rot_vel: -1.0
sim_time: 1.7
sim_granularity: 0.025
goal_distance_bias: 1.0
path_distance_bias: 24.0
occdist_scale: 0.1
stop_time_buffer: 0.2
oscillation_reset_dist: 0.05
forward_point_distance: 0.325
scaling_speed: 0.25
max_scaling_factor: 0.2
vx_samples: 10
vy_samples: 0
vtheta_samples: 20
sim_period: 0.1
controller_frequency: 20
xy_goal_tolerance: 0.5
yaw_goal_tolerance: 3.14
rot_stopped_vel: 0.01
trans_stopped_vel: 0.01
全局规划器
base_global_planner_params.yaml
GlobalPlanner
GlobalPlanner:
lethal_cost : 253
neutral_cost : 50
cost_factor : 3.0
publish_potential : true
carrot_planner_params.yaml
CarrotPlanner
CarrotPlanner:
min_dist_from_robot : 0.10
ros navigation move_base 节点 launch 文件
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<!-- 地图参数 -->
<rosparam file="$(find navi_pkg)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<!-- ns 就是namespace 一定要配置正确,否则找不到对应的规划器 -->
<rosparam file="$(find navi_pkg)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find navi_pkg)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find navi_pkg)/global_costmap_params.yaml" command="load" />
<!-- 规划器参数 选择自己使用的一组全局和局部即可 -->
<rosparam file="$(find navi_pkg)/base_global_planner_params.yaml" command="load" />
<rosparam file="$(find navi_pkg)/carrot_planner_params.yaml" command="load" />
<rosparam file="$(find navi_pkg)/base_local_planner_params.yaml" command="load" />
<rosparam file="$(find navi_pkg)/dwa_local_planner_params.yaml" command="load" />
<rosparam file="$(find navi_pkg)/move_base_params.yaml" command="load" />
<!--加载以上配置的yaml 文件 -->
<!--A1配置全局规划器 CarrotPlanner 目标点可在障碍物中-->
<param name="base_global_planner" value="carrot_planner/CarrotPlanner" />
<!--A2配置全局规划器 GlobalPlanner Dijkstras or A* -->
<param name="base_global_planner" value="global_planner/GlobalPlanner" />
<!--A3配置全局规划器 NavfnROS Dijkstra -->
<param name="base_global_planner" value="navfn/NavfnROS" />
<!--B1配置局部规划器 TrajectoryPlannerROS DWA or Trajectory Rollout -->
<param name="base_local_planner" value="base_local_planner/TrajectoryPlannerROS"/>
<!--B2配置局部规划器 DWAPlannerROS DWA-->
<param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS"/>
</node>
配置主要看插件文件比如