也可以使用安装usb_cam package的流程和上面的uvc_cam几乎一样:
$ cd ~/catkin_ws/src
$ git clone https://github.com/bosch-ros-pkg/usb_cam.git
$ cd ~/catkin_ws
$ catkin_make
我外接usb罗技摄像头,如果使用笔记本自带摄像头直接启动usb_cam启动文件即可
直接修改usb_cam包的启动文件usb_cam.launch
修改参数参考官网说明http://wiki.ros.org/usb_cam
笔记本自带的摄像头的设备号一般为/dev/video0 外接摄像头一般是
<param name="video_device" value="/dev/video1" />
~pixel_format (string, default: "mjpeg") Possible values are mjpeg, yuyv, uyvy
我的摄像头这个参数不是默认值
<param name="pixel_format" value="yuyv" />
<launch> <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" > <param name="video_device" value="/dev/video1" /> <param name="image_width" value="640" /> <param name="image_height" value="480" /> <param name="framerate" value="30" /> <param name="pixel_format" value="yuyv" /> <param name="camera_frame_id" value="usb_cam" /> <param name="io_method" value="mmap"/> </node> <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen"> <remap from="image" to="/usb_cam/image_raw"/> <param name="autosize" value="true" /> </node> </launch>
roslaunch usb_cam usb_cam.launch