最近在做局部规划器方面的研究,需要用到ros中的dwb_local_planner,虽然在ros中有官方给出的包,但我直接使用sudo apt-get install ros-melodic-dwb-local-planner-dev 安装之后无法使用,原因可能是因为虽然dwb_local_planner本身虽然是个基于base_local_planner的插件,但是其本身的实现使用了David.Lu自己编写的插件,这部分在安装官方给到的local planner时并没有提供,所以导致出现各种错误(如常见错误)。因此在这里记录一下自己如何解决的dwb_local_planner使用问题。
常见错误
Failed to create the nav_core_adapter::LocalPlannerAdapter planner, are you sure it is properly registered and that the containing library is built? Exception: Could not find library corresponding to plugin mir_dwb_critics::PathDistPrunedCritic.
Installation
sudo apt install ros-$ROS_DISTRO-nav-core-adapter sudo apt install ros-$ROS_DISTRO-nav-core2 sudo apt install ros-$ROS_DISTRO-dwb-local-planner (以防万一缺少包) 其中$ROS_DISTRO 为当前ROS版本号- 请访问David.Lu的Github将robot_navigation包
git clone 到工作目录下,之后执行catkin_make 进行编译。
Configuration
move_base configuration(launch):
<param name="base_local_planner" value="nav_core_adapter::LocalPlannerAdapter" />
<param name="LocalPlannerAdapter/planner_name" value="dwb_local_planner::DWBLocalPlanner" />
对应dwa配置中的
<param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
yaml:
base_local_planner: nav_core_adapter::LocalPlannerAdapter
LocalPlannerAdapter:
planner_name: dwb_local_planner::DWBLocalPlanner
DWBLocalPlanner:
其余参数与dwa相同。 local_costmap:
plugins:
-{name: costmap_ros, type: "nav_core_adapter::CostmapAdapter"}
-{name: laser_horizontal_layer, type: "costmap_2d::ObstacleLayer"}
-{name: laser_cliff_layer, type: "costmap_2d::VoxelLayer"}
-{name: inflation_layer, type: "costmap_2d::InflationLayer"}
之后按照正常的导航流程走就可以啦
|