大部分內容參考自:
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>