TEB轨迹规划算法教程-配置和导航
TEB轨迹规划算法教程-配置和导航
说明:
- 介绍如何将teb_local_planner设置为导航包的本地计划程序插件
2d导航包
- 请确保将机器人设置为符合2d导航包(传感器,costmap2d和机器人驱动程序/模拟器)。
- 请参阅以下教程:导航:RobotSetup。
- 之后,您可能已经创建了一个包含机器人导航任务的配置和启动文件的小包。
- 主要配置文件是:
costmap_common_params.yaml
global_costmap_params.yaml
local_costmap_params.yaml
base_local_planner_params.yaml
- 此外,该软件包应包含一个类似于以下内容的启动文件move_base.launch:
<launch>
<master auto="start"/>
<!-- Run the map server -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find my_map_package)/my_map.pgm my_map_resolution"/>
<!--- Run AMCL -->
<!--- We load ACML here with diff=true to support our differential drive robot -->
<include file="$(find amcl)/examples/amcl_diff.launch" />
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find my_robot_name_2dnav)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find my_robot_name_2dnav)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find my_robot_name_2dnav)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot_name_2dnav)/global_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot_name_2dnav)/base_local_planner_params.yaml" command="load" />
</node>
</launch>
- 您现在应该能够使用默认的本地和全局规划器运行导航。
- 检查上面教程中的参考文献,以便发送导航目标。
安装和配置TEB
- 现在,您的机器人在(模拟或真实)环境中正确导航后,您可以将teb_local_planner激活为本地计划程序。
- 插入行到move_base.launch文件:
<param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" />
- 完成如下:
<launch>
<master auto="start"/>
<!-- Run the map server -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find my_map_package)/my_map.pgm my_map_resolution"/>
<!--- Run AMCL -->
<!--- We load ACML here with diff=true to support our differential drive robot -->
<include file="$(find amcl)/examples/amcl_diff.launch" />
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find my_robot_name_2dnav)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find my_robot_name_2dnav)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find my_robot_name_2dnav)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot_name_2dnav)/global_costmap_params.yaml" command="load" />
<rosparam file="$(find my_robot_name_2dnav)/base_local_planner_params.yaml" command="load" />
<param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" />
<param name="controller_frequency" value="10.0" />
</node>
</launch>
- 注意,我们还添加了一个参数来调整控制器频率。
- 现在使用teb_local_planner包的参数更新base_local_planner_params.yaml配置文件。
- 要捕获附近的所有参数,请使用以下模板(版本0.3+):
TebLocalPlannerROS:
odom_topic: odom
map_frame: /odom
# Trajectory
teb_autosize: True
dt_ref: 0.3
dt_hysteresis: 0.1
global_plan_overwrite_orientation: True
max_global_plan_lookahead_dist: 3.0
feasibility_check_no_poses: 5
# Robot
max_vel_x: 0.4
max_vel_x_backwards: 0.2
max_vel_theta: 0.3
acc_lim_x: 0.5
acc_lim_theta: 0.5
min_turning_radius: 0.0
footprint_model: # types: "point", "circular", "two_circles", "line", "polygon"
type: "point"
radius: 0.2 # for type "circular"
line_start: [-0.3, 0.0] # for type "line"
line_end: [0.3, 0.0] # for type "line"
front_offset: 0.2 # for type "two_circles"
front_radius: 0.2 # for type "two_circles"
rear_offset: 0.2 # for type "two_circles"
rear_radius: 0.2 # for type "two_circles"
vertices: [ [0.25, -0.05], [0.18, -0.05], [0.18, -0.18], [-0.19, -0.18], [-0.25, 0], [-0.19, 0.18], [0.18, 0.18], [0.18, 0.05], [0.25, 0.05] ] # for type "polygon"
# GoalTolerance
xy_goal_tolerance: 0.2
yaw_goal_tolerance: 0.1
free_goal_vel: False
# Obstacles
min_obstacle_dist: 0.4
include_costmap_obstacles: True
costmap_obstacles_behind_robot_dist: 1.0
obstacle_poses_affected: 30
costmap_converter_plugin: ""
costmap_converter_spin_thread: True
costmap_converter_rate: 5
# Optimization
no_inner_iterations: 5
no_outer_iterations: 4
optimization_activate: True
optimization_verbose: False
penalty_epsilon: 0.1
weight_max_vel_x: 2
weight_max_vel_theta: 1
weight_acc_lim_x: 1
weight_acc_lim_theta: 1
weight_kinematics_nh: 1000
weight_kinematics_forward_drive: 1
weight_kinematics_turning_radius: 1
weight_optimaltime: 1
weight_obstacle: 50
weight_dynamic_obstacle: 10 # not in use yet
alternative_time_cost: False # not in use yet
# Homotopy Class Planner
enable_homotopy_class_planning: True
enable_multithreading: True
simple_exploration: False
max_number_classes: 4
roadmap_graph_no_samples: 15
roadmap_graph_area_width: 5
h_signature_prescaler: 0.5
h_signature_threshold: 0.1
obstacle_keypoint_offset: 0.1
obstacle_heading_threshold: 0.45
visualize_hc_graph: False
- 然后通过重新启动导航启动文件并命令新目标来测试您的设置。
- 随意使用rqt_reconfigure以在运行时调整支持的参数:
rosrun rqt_reconfigure rqt_reconfigure
仿真:
- 安装teb_local_planner_tutorials包,前面已经介绍
- 启动不同的车型文件,如下是差速demo:
roslaunch teb_local_planner_tutorials robot_diff_drive_in_stage.launch
- 通过修改参数来调整:
rosrun rqt_reconfigure rqt_reconfigure
代价地图问题:
- 本地代价地图的分辨率和大小(请参阅local_costmap_params.yaml)会显着影响优化的性能,因为每个占用的代价地图单元都被视为单点障碍。
- 对于大量障碍,由于数值不稳定性,在独特拓扑中的并行规划可能会失败。
- 在这种情况下,尝试增加分辨率或减小大小,直到修复或绕过此问题(否则您可能会尝试稍微减小h_signature_prescaler的值)。
抖动问题:
- 如果机器人试图在(真的)狭窄的走廊中旋转,则可能发生由于噪声激光数据,测距和amcl姿势的校正,计划的轨迹在不同的运动模式(左/右/前/后)之间交替切换。
- 机器人可能会卡住(这个问题主要影响阿克曼机器人;对于我的差速器驱动机器人,效果可以忽略不计)。
- 如果有人有建议,解决方案或想法,请在github上分享(报告问题/拉取请求)。
获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号