(1).问题:因为是解决后写的博客,没有截图并记录全部错误信息.大体是:
OpenCV Error: Bad argument (Invalid pointer to file storage) in cvGetFileNod....../tem/...ros-kinetic-opencv3.3.1/......
(2).问题解析:打开 .../ORB_SLAM2/cmakelists.txt 和 .../ORB_SLAM2/Examples/ROS/ORB_SLAM2/cmakelists.txt 可以看到要求opencv的版本是opencv3或opencv2.4.3,如图
,
而kinetic默认安装的是opencv3.3.1,版本不一样会报错.
(3)解决办法:修改.../ORB_SLAM2/cmakelists.txt 和 .../ORB_SLAM2/Examples/ROS/ORB_SLAM2/cmakelists.txt 中上图部分为
除了修改31行,我也修改了第33行,以为之前另外安装了opencv2.4.13.修改后执行以下命令:
$ roscore
$ rosrun ORB_SLAM2 MonoAR Vocabulary/ORBvoc.txt Examples/ROS/ORB_SLAM2/Asus.yaml
$ rosbag play rgbd_dataset_freiburg1_desk.bag /camera/rgb/image_color:=/camera/image_raw
无报错.
命令参考:<ROS机器人开发实践 胡春旭>