大部分内容参考自:
ros_by_example_hydro_volume_1.pdf
主要是讲如何让先锋机器人在空白地图上运动
上面图是navigation框架图,可以看到move_base处在核心地位
move_base这个包由许多组件组成
详细看:
http://wiki.ros.org/move_base?distro=kinetic
component apis部分
/map提供全局地图
/tf提供当前全局位姿
“odom”topic提供机器人速度与角速度,这个在DWA(动态窗口法)中会用到,
因为动态窗口法是使用当前机器人速度与角速度推断一段时间后轨迹看看会不会与障碍物相碰
sensor topics 还没有弄明白点云是怎么转换成cost_map
如何使用move_base:
move_base这个包启动后会同时启用
global_planner:参数配置链接:http://wiki.ros.org/global_planner?distro=kinetic
local_planner:参数配置链接:http://wiki.ros.org/base_local_planner?distro=kinetic
global_costmap:参数配置链接:http://wiki.ros.org/costmap_2d
local_costmap:参数配置链接:http://wiki.ros.org/costmap_2d
参数文件配置范例参考:ros by example volume1 中 8.1.2小节
其中planner可以通过设置move_base参数
http://wiki.ros.org/move_base?distro=kinetic
~base_global_planner (string, default: "navfn/NavfnROS" For 1.1+ series)
- The name of the plugin for the global planner to use with move_base, see pluginlib documentation for more details on plugins. This plugin must adhere to the nav_core::BaseGlobalPlanner interface specified in the nav_core package. (1.0 series default: "NavfnROS")
~base_local_planner (string, default: "base_local_planner/TrajectoryPlannerROS" For 1.1+ series)
- The name of the plugin for the local planner to use with move_base see pluginlib documentation for more details on plugins. This plugin must adhere to the nav_core::BaseLocalPlanner interface specified in the nav_core package. (1.0 series default: "TrajectoryPlannerROS")
比如要使用别的local planner
http://wiki.ros.org/nav_core#BaseLocalPlanner
上面链接有说明哪些现成local planner可以用
比如用eband_local_planner
http://wiki.ros.org/eband_local_planner
<node pkg="move_base" type="move_base" name="move_base"> <param name="base_local_planner" value="eband_local_planner/EBandPlannerROS"/> ... </node>
就可以在move_base使用使用eband_local_planner了
move_base默认使用base_local_planner
这个可以在
~base_local_planner (string, default: "base_local_planner/TrajectoryPlannerROS" For 1.1+ series)
中看出来
指定了planner之后就可以到对应页面参考参数设置了
之后是一个例子,实现局部路径规划(避障)
因为不需要全局cost_map,所以将/odom和/map固定在一块,用/odom tf来进行定位
两个launch file
这个launch file是启动先锋机器人驱动
<launch> <!--launch driver--> <node pkg="rosaria" type="RosAria" name="RosAria"> <param name="port" value="/dev/ttyUSB0" /> </node> <!-- Launch move_base and load all navigation parameters --> <include file="$(find pioneer_zed)/launch/pioneer_move_base.launch" /> <!-- Run the map server with a blank map --> <node name="map_server" pkg="map_server" type="map_server" args="$(find pioneer_zed)/maps/blank_map.yaml" /> <!-- Run a static transform between /odom and /map --> <node pkg="tf" type="static_transform_publisher" name="odom_map_broadcaster" args="0 0 0 0 0 0 /map /odom 100" /> </launch>
这个launch file是move_base配置
<launch> <node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen" clear_params="true"> <remap from="/cmd_vel" to="/RosAria/cmd_vel"/> <rosparam file="$(find pioneer_zed)/config/costmap_common_params.yaml" command="load" ns="global_costmap" /> <rosparam file="$(find pioneer_zed)/config/costmap_common_params.yaml" command="load" ns="local_costmap" /> <rosparam file="$(find pioneer_zed)/config/local_costmap_params.yaml" command="load" /> <rosparam file="$(find pioneer_zed)/config/global_costmap_params.yaml" command="load" /> <rosparam file="$(find pioneer_zed)/config/base_local_planner_params.yaml" command="load" /> </node> </launch>