一个usb接口的摄像头,本次使用罗技(Logitech)摄像头。
一、使用软件库里的uvc-camera功能包
1.1 检查摄像头
lsusb
显示如下:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 046d:082b Logitech, Inc. Webcam C170
Bus 001 Device 006: ID 0461:4e2a Primax Electronics, Ltd
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
1.2 安装uvc camera功能包
sudo apt-get install ros-kinetic-uvc-camera
1.3 安装image相关功能包
sudo apt-get install ros-kinetic-image-*
sudo apt-get install ros-kinetic-rqt-image-view
1.4 运行uvc_camera节点
rosrun uvc_camera uvc_camera_node
1.5 查看图像信息(三种方式)
(1)使用image_view节点查看图像
rosrun image_view image_view image:=/image_raw
说明:
最后面的附加选项“image:=/image_raw”是把话题列表中的话题以图像形式查看的选项。
(2)用rqt_image_view节点检查
rqt_image_view image:=/image_raw
(3)使用rviz查看
rviz
增加 image
,然后将[Image]
→ [Image Topic]
的值更改为“/image_raw
”。
使用apt-get安装的软件包好像只有执行程序,没有launch文件和节点源文件等等,所以采用了自建uvc-camera软件包更该参数。