赞
踩
最近刚写完开题报告,然后在研究局部导航避障算法DWA和TEB这两种算法的原理和区别。DWA ROS中自带,而TEB算法需要自行安装下载和配置,以下是我配置的步骤。
github源码地址
注意自己的版本
编译过程中会提示缺少依赖,缺少什么按照提示安装什么就好!
编译完成在终端输入
rospack plugins --attrib=plugin nav_core
如果显示有teb_local_planner,则安装成功。
roscd turtlebot3_navigation/
ls
see launch
在 launch 目录下打开终端输入
sudo gedit move_base.launch
<launch>
<!-- Arguments -->
<arg name="model" default="$(env TURTLEBOT3_MODEL)" doc="model type [burger, waffle, waffle_pi]"/>
<arg name="cmd_vel_topic" default="/cmd_vel" />
<arg name="odom_topic" default="odom" />
<arg name="move_forward_only" default="false"/>
<!-- move_base -->
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<param name="base_local_planner" value="teb_local_planner/TebLocalPlannerROS" />
<rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="global_costmap" />
<rosparam file="$(find turtlebot3_navigation)/param/costmap_common_params_$(arg model).yaml" command="load" ns="local_costmap" />
<rosparam file="$(find turtlebot3_navigation)/param/local_costmap_params.yaml" command="load" />
<rosparam file="$(find turtlebot3_navigation)/param/global_costmap_params.yaml" command="load" />
<rosparam file="$(find turtlebot3_navigation)/param/move_base_params.yaml" command="load" />
<rosparam file="$(find turtlebot3_navigation)/param/teb_local_planner_params.yaml" command="load" />
<remap from="cmd_vel" to="$(arg cmd_vel_topic)"/>
<remap from="odom" to="$(arg odom_topic)"/>
<param name="DWAPlannerROS/min_vel_x" value="0.0" if="$(arg move_forward_only)" />
</node>
</launch>
在turtlebot3_navigation/param目录下新建一个
sudo touch teb_local_planner_params.yaml
TebLocalPlannerROS:
odom_topic: odom
map_frame: map
# Trajectory
teb_autosize: True
dt_ref: 0.5
dt_hysteresis: 0.05
min_samples: 3
global_plan_overwrite_orientation: True
global_plan_viapoint_sep: 0.1 # negative, do not use viapoints. positive, use them. the actual value does not matter
max_global_plan_lookahead_dist: 1.5
global_plan_prune_distance: 0.6
force_reinit_new_goal_dist: 1.0
feasibility_check_no_poses: 3
publish_feedback: false
allow_init_with_backwards_motion: true
exact_arc_length: false
shrink_horizon_backup: true
shrink_horizon_min_duration: 10
# Robot
max_vel_x: 0.22
max_vel_x_backwards: 0.5
max_vel_theta: 2.75
max_vel_y: 0.0
acc_lim_y: 0.0
acc_lim_x: 2.5
acc_lim_theta: 3.2
min_turning_radius: 0.0
wheelbase: 0.0 # not used, is differential
cmd_angle_instead_rotvel: false # not used, is differential
footprint_model: # types: "point", "circular", "two_circles", "line", "polygon"
# type: "circular"
# radius: 0.5 # for type "circular"
# type: "line"
# line_start: [-0.0545, 0.0] # for type "line"
# line_end: [0.0545, 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"
type: "polygon"
vertices: [[-0.105, -0.105], [-0.105, 0.105], [0.041, 0.105], [0.041, -0.105]] # for type "polygon"
# GoalTolerance
xy_goal_tolerance: 0.05
yaw_goal_tolerance: 0.17
free_goal_vel: False
# Obstacles
min_obstacle_dist: 0.1 # minimum distance to obstacle: it depends on the footprint_model
inflation_dist: 0.0 # greater than min_obstacle_dist to take effect
include_costmap_obstacles: True # use the local costmap
costmap_obstacles_behind_robot_dist: 1.0 # distance at which obstacles behind the robot are taken into account
legacy_obstacle_association: false
obstacle_poses_affected: 30 # unused if legacy_obstacle_association is false
obstacle_association_force_inclusion_factor: 10.0 # the obstacles that will be taken into account are those closer than min_obstacle_dist*factor, if legacy is false
obstacle_association_cutoff_factor: 40.0 # the obstacles that are further than min_obstacle_dist * factor will not be taken into account, if legacy is false
# costmap_converter_plugin: "costmap_converter::CostmapToPolygonsDBSMCCH"
#costmap_converter_plugin: "costmap_converter::CostmapToLinesDBSRANSAC"
#costmap_converter_plugin: "costmap_converter::CostmapToLinesDBSMCCH"
# costmap_converter_plugin: "costmap_converter::CostmapToPolygonsDBSConcaveHull"
costmap_converter_plugin: "" # deactivate plugin
costmap_converter_spin_thread: True
costmap_converter_rate: 10
# Optimization
no_inner_iterations: 5
no_outer_iterations: 4
optimization_activate: True # optimize
optimization_verbose: False
penalty_epsilon: 0.1
weight_max_vel_x: 2
weight_max_vel_y: 1
weight_max_vel_theta: 1
weight_acc_lim_x: 1
weight_acc_lim_y: 1
weight_acc_lim_theta: 1
weight_kinematics_nh: 1 # is a holonomic robot
weight_kinematics_forward_drive: 10 # prefer forward driving, for differential
weight_kinematics_turning_radius: 0 # prefer turns that respect the min_turning_radius, not used if differential (min_turning_radius = 0)
weight_optimaltime: 1.0 # prefer trajectories with less transition time
weight_obstacle: 50.0 # prefer trajectories that respect the min_obstacle_dist
weight_inflation: 0.1 # prefer trajectories that respect the inflation of the obstacles
#weight_dynamic_obstacle: 10 # not in use yet
weight_viapoint: 1.0 # prefer trajectories that respect the viapoints in the global path
weight_adapt_factor: 2 # factor to multiply some weights (currently only weight_obstacle) at each iteration (gives better results than a huge value for the weight)
# Homotopy Class Planner
enable_homotopy_class_planning: True # currently not used
上面的步骤应该是没有问题的,因为我都测试完了,下面是我写的launch测试
打开仿真环境
roslaunch test_planner test_planner.launch
效果
只是配置完成了,由于配置文件中有大量参数,目前对参数还有没深入了解,刚开始的参数是直接拷贝一片CSDN的,然后上来进行导航没有任何反应,不动,误以为配置不对,后来发现是参数跟Turtlebot3不匹配,按照现有的理解,改了改参数,可以动了,一边调试一边体会吧。
参数调试可以参考
浅谈Time Elastic Band -深蓝学院
ROS - teb_local_planner 参数总结-Dr. Qing
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。