ROS机器人项目开发11例-ROS Robotics Projects(1)代码使用编译
ROS Robotics Projects代码编译等的一些小坑
看到这边书觉得非常不错,第一时间下载代码调试,发现有些小bug。
这里主要是一些配置问题,书中推荐是kinetic版本,那么测试必然要用indigo啦,
如果书中推荐indigo,一般用kinetic测试
原书示例代码下载:https://github.com/qboticslabs/ros_robotics_projects
首先,作者为了让小伙伴们更好的学习这本书----自己练习,将一些代码文件改为如下:
face_tracker_node.cpp.txt
如果自己只想看效果,需要修改:
face_tracker_node.cpp
不同版本的opencv,注意路径配置等,如果遇到opencv部分头文件找不到的情况,请参考如下:
-
//Open-CV headers
-
#include <opencv2/imgproc/imgproc.hpp>
-
#include <opencv2/highgui/highgui.hpp>
-
#include "opencv2/objdetect/objdetect.hpp"
----
还有编译不报错了,那么运行就没有问题了吗?
比如下面这个错误:
ERROR: Could not load classifier cascade
以第二章的人脸识别为示例:
$ roslaunch face_tracker_pkg start_tracking.launch
-
... logging to /home/relaybot/.ros/log/419f0c24-1690-11e7-9614-0811968dc4b0/roslaunch-exbot-ThinkPad-T420s-2938.log
-
Checking log directory for disk usage. This may take awhile.
-
Press Ctrl-C to interrupt
-
Done checking log file disk usage. Usage is <1GB.
-
-
started roslaunch server http://exbot-ThinkPad-T420s:45721/
-
-
SUMMARY
-
========
-
-
PARAMETERS
-
* /display_original_image: 1
-
* /display_tracking_image: 1
-
* /face_detected_image_topic: /face_detector/ra...
-
* /face_tracking: 1
-
* /haar_file_face: 1/home/relaybot/b...
-
* /image_input_topic: /usb_cam/image_raw
-
* /rosdistro: indigo
-
* /rosversion: 1.11.21
-
* /usb_cam/auto_focus: False
-
* /usb_cam/camera_frame_id: usb_cam
-
* /usb_cam/image_height: 480
-
* /usb_cam/image_width: 640
-
* /usb_cam/io_method: mmap
-
* /usb_cam/pixel_format: yuyv
-
* /usb_cam/video_device: /dev/video0
-
-
NODES
-
/
-
face_tracker (face_tracker_pkg/face_tracker_node)
-
usb_cam (usb_cam/usb_cam_node)
-
-
auto-starting new master
-
process[master]: started with pid [2950]
-
ROS_MASTER_URI=http://localhost:11311
-
-
setting /run_id to 419f0c24-1690-11e7-9614-0811968dc4b0
-
process[rosout-1]: started with pid [2963]
-
started core service [/rosout]
-
process[usb_cam-2]: started with pid [2966]
-
process[face_tracker-3]: started with pid [2967]
-
[ INFO] [1491019450.108638897]: Successfully Loaded tracking parameters
-
[ INFO] [1491019450.199495687]: using default calibration URL
-
[ INFO] [1491019450.199610077]: camera calibration URL: file:///home/relaybot/.ros/camera_info/head_camera.yaml
-
[ INFO] [1491019450.199706530]: Unable to open camera calibration file [/home/relaybot/.ros/camera_info/head_camera.yaml]
-
[ WARN] [1491019450.199748678]: Camera calibration file /home/relaybot/.ros/camera_info/head_camera.yaml not found.
-
[ INFO] [1491019450.199798247]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS
-
[ WARN] [1491019450.295375208]: unknown control 'focus_auto'
-
-
ERROR: Could not load classifier cascade
-
ERROR: Could not load classifier cascade
-
ERROR: Could not load classifier cascade
-
ERROR: Could not load classifier cascade
----
明显是人脸识别配置有点问题啊。
修改track.yaml
注意data中face.xml的路径。比如本机就是如下情况:
-
image_input_topic: "/usb_cam/image_raw"
-
face_detected_image_topic: "/face_detector/raw_image"
-
haar_file_face: "/home/relaybot/books_ws/src/ROS_Robotics_Projects_master/Chapter02/codes/face_tracker_pkg/data/face.xml"
-
face_tracking: 1
-
display_original_image: 1
-
display_tracking_image: 1
----
再试一次:
roslaunch face_tracker_pkg start_tracking.launch
~End~
文章来源: zhangrelay.blog.csdn.net,作者:zhangrelay,版权归原作者所有,如需转载,请联系作者。
原文链接:zhangrelay.blog.csdn.net/article/details/68942938
- 点赞
- 收藏
- 关注作者
评论(0)