Navigation导航包是做导航几乎都要用的,大家可以先去ROS Wiki上学习下
我们先Git下对应版本的软件包,我是Kinetic的,所以是Kinetic-devel
下载后发现目录下并没有CMakeLists.txt,所以直接在ROS工作目录下catkin_make并不会产生可执行文件
所以编写了build.sh脚本文件,如下:
echo "Building Navigation Pack"
cd ~/catkin_wsecho -e "\nBuild amcl..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="amcl"echo -e "\nBuild base_local_planner..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="base_local_planner"echo -e "\nBuild carrot_planner..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="carrot_planner"echo -e "\nBuild clear_costmap_recovery..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="clear_costmap_recovery"echo -e "\nBuild costmap_2d..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="costmap_2d"echo -e "\nBuild dwa_local_planner..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="dwa_local_planner"echo -e "\nBuild fake_localization..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="fake_localization"echo -e "\nBuild global_planner..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="global_planner"echo -e "\nBuild map_server..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="map_server"echo -e "\nBuild move_base..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="move_base"echo -e "\nBuild move_slow_and_clear..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="move_slow_and_clear"echo -e "\nBuild nav_core..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="nav_core"echo -e "\nBuild navfn..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="navfn"echo -e "\nBuild navigation..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="navigation"echo -e "\nBuild robot_pose_ekf..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="robot_pose_ekf"echo -e "\nBuild rotate_recovery..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="rotate_recovery"echo -e "\nBuild voxel_grid..."
catkin_make -DCATKIN_WHITELIST_PACKAGES="voxel_grid"
在navigation-kinetic-devel目录下打开终端
chmod +x build.sh
./build.sh
即可完成编译
编译过程中可能会报错:
/home/redwall/catkin_ws/src/navigation-kinetic-devel/costmap_2d/cfg/Costmap2D.cfg 拒绝访问
之类的问题,其实就是该文件缺少可执行权限
打开任意终端,输入:
chmod +x /home/redwall/catkin_ws/src/navigation-kinetic-devel/costmap_2d/cfg/Costmap2D.cfg
但是像这种/cfg整个文件夹的,直接
chmod -R +x /home/redwall/catkin_ws/src/navigation-kinetic-devel/costmap_2d/cfg
还有就是编译costmap_2d提示缺少eigen3的依赖,实际上在/usr/local/include和/usr/include中都有,只是没在它指定的路径,打开终端
mkdir includesudo cp -r /usr/local/include/eigen3 ~/include
问题基本上就是上面几点,最后在navigation-kinetic-devel目录下运行build.sh
多运行几次,最后没有报错,就编译安装成功了