《ROS机器人高效编程(原书第3版)》一书中源码编译问题解决

我在ROS的kinetic版本下编译该源码,发现好多功能包不能存在,解决方式如下:

1、执行下面命令

mkdir -p ~/effective_robotics_programming_with_ros/src

cd ~/effective_robotics_programming_with_ros/src

catkin_init_workspace

2、将effective_robotics_programming_with_ros源码拷贝到effective_robotics_programming_with_ros/src目录下,并执行下面命令回到effective_robotics_programming_with_ros目录下。

cd ~/effective_robotics_programming_with_ros

3、执行下面命令安装源码所需依赖包。

sudo rosdep init
rosdep update
rosdep install --from-paths src --ignore-src -r -y

4、安装依赖包后使用catkin_make编译

5、编译后会提示example4冲突

example4的问题解决方式就是在chapter3_tutorials目录下的CMakeLists.txt中将example4改为另一个名字即可。

CMakeLists.txt中的example4.cpp的文件名不用改。

5、使用catkin_make再次编译有会出现moveit_simple_grasps包问题。

由于网址中下载的moveit_simple_grasps-kinetic-devel源码缺头文件,故编译不成功,只好去chapter7_tutorials目录下的CMakeLists.txt中屏蔽moveit_simple_grasps。

6、再次使用catkin_make会报chapter9_tutorials的链接问题,修改方法如下:

打开chapter9_tutorials目录下的CMakeLists.txt文件,在每条target_link_libraries语句的")"前加上" ${OpenCV_LIBRARIES}"即可。

在下面语句的OpenCV后添加" 2.4 ":

find_package(OpenCV 2.4 REQUIRED)

即改为:find_package(OpenCV 2.4 REQUIRED)

7、catkin_make编译后会报chapter9_tutorials的opencv2/nonfree/nonfree.hpp问题,修改如下:

7.1 按照网址https://blog.csdn.net/a1102029952/article/details/78618576?locationNum=7&fps=1中所说的编译安装OpenCV 2.4.13.6

7.2 按照网址https://blog.csdn.net/bigdog_1027/article/details/79092263中说的将kinetic下使用的OpenCV3改成使用OpenCV2

7.3 在/usr/local/include/opencv2/nonfree/features2d.hpp 中的合适地方添加using namespace std;语句以及注释掉AlgorithmInfo* info() const;语句


  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值