局部路径规划器teb_local_planner详解2:关于避障

前言

局部路径规划器teb_local_planner详解之初识teb中,我们初步认识了teb算法,知道如何在move_base中实现运行。

本部分我们详细探讨,TEB避障的实现,以及与避障相关的各个参数对算法性能表现的影响。

一、 避障

1. 避障约束

避障是整个轨迹优化的一部分。优化的目的是寻找代价最小的轨迹解决方案。

teb算法将避障硬约束转换为软约束。举个例子如图所示:

在这里插入图片描述上图中与避障相关的参数:

min_obstacle_dist: 最小避障距离0.2m
weight_obstacle: 避障在整个优化函数中的权重
extra margin:给min_obstacle_dist额外加个边
penalty_eposilon: 一次性修改全部惩罚项。注意,谨慎操作


2. 局部极值

陷入局部极值的状态:

在这里插入图片描述
使用多条轨迹的teb算法:the homotopy class planning algorithm会尝试沿着障碍物构成的拓扑地图,寻找多条轨迹。避免陷入极值。

3. 避障与跟随全局pose的关系

在这里插入图片描述重要的参数:

dt_ref:参考轨迹的离散间隔
obstacle_poses_affected: 因为障碍物而受到影响的poses数量(基于距离障碍物最近的pose,向两边扩展的点数)

只有被affected的pose会被选中拿去做优化。

上图中,也能看到,机器人的footprint模型在计算障碍物距离的时候影响很大。

二、机器人footprint模型

模型对碰撞检测的计算很重要。设好了能极大降低运算量。

这个参数是teb自己定的,不是直接从costmap_2d中导入进来的。

TebLocalPlannerROS:
 footprint_model: # types: "point", "circular", "line", "two_circles", "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"

1. point

机器人模型为点模型,这种模型消耗资源最小

2. circular

根据给定的参数~/footprint_model/radius来决定的圆半径模型。

计算碰撞的方法和point差不多,只是将radius加入了参数min_obstacle_dist

3. line

在这里插入图片描述

4. two circles

在这里插入图片描述

5. polygon

非常复杂的模型可以用多边形表示。通过一系列的顶点来构成。


下一章: 局部路径规划器teb_local_planner详解3:跟随全局planner

teb_local_planner是ROS中的一个局部路径规划,用于生成机人在环境中的局部路径。以下是使用teb_local_planner的基本步骤: 1. 安装teb_local_planner: ``` sudo apt-get install ros-<distro>-teb-local-planner ``` 2. 在机人的工作空间中创建一个catkin包,并在package.xml中添加如下依赖项: ``` <build_depend>teb_local_planner</build_depend> <run_depend>teb_local_planner</run_depend> ``` 3. 创建一个launch文件,将teb_local_planner配置为全局规划的子规划: ```xml <launch> <node name="move_base" pkg="move_base" type="move_base" respawn="false" output="screen"> <rosparam file="$(find your_robot_config)/base_local_planner_params.yaml" command="load" /> <rosparam file="$(find your_robot_config)/global_planner_params.yaml" command="load" /> <param name="base_global_planner" value="navfn/NavfnROS" /> <param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" /> </node> </launch> ``` 4. 在机人配置文件夹下创建一个base_local_planner_params.yaml文件,并在其中添加TebLocalPlannerROS的参数设置。这里提供一个示例: ```yaml # TEB Local Planner parameters TrajectoryPlannerROS: max_vel_x: 0.5 max_rotational_vel: 1.0 min_in_place_rotational_vel: 0.1 escape_vel: -0.1 acc_lim_x: 1.0 acc_lim_th: 1.0 holonomic_robot: false max_vel_theta: 1.0 min_turning_radius: 0.2 footprint_model: consavable_laser_scan footprint_padding: 0.1 teb_autosize: true dt_ref: 0.3 dt_hysteresis: 0.1 min_samples: 3 global_plan_overwrite_orientation: true allow_init_with_backwards_motion: false max_global_plan_lookahead_dist: 3.0 force_reinit_new_goal_dist: 1.0 force_reinit_new_goal_angular: 0.2 inscribed_radius: 0.25 circumscribed_radius: 0.3 costmap_converter_plugin: "" costmap_converter_spin_thread: true visualize_subsampled_path: false visualize_voronoi_path: false visualize_infeasible_points: false visualize_dynamic_obstacles: false delete_detours_backwards: false detours_orientation_tolerance: 0.1 weight_viapoint: 1.0 weight_optimaltime: 1.0 weight_shortest_path: 0.0 viapoints_all_candidates: false max_number_classes: 0 selection_cost_hysteresis: 0.1 selection_prefer_initial_plan: false selection_obst_cost_scale: 10.0 selection_viapoint_cost_scale: 1.0 selection_alternative_time_cost: true selection_dropping_probability: 0.0 selection_dropping_memory: 2 ``` 5. 启动机人并运行局部路径规划: ``` roslaunch your_robot_name teb_local_planner.launch ``` 以上是使用teb_local_planner的基本步骤,你需要根据你的机人配置和任务需求进行相应的参数配置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值