ROS usb_cam安装

1. 创建工作空间 http://blog.csdn.net/xiaocainiaoshangxiao/article/details/13293637
   设置环境变量:
    source /opt/ros/hydro/setup.bash 
  创建一个工作空间:
  mkdir -p ~/catkin_ws/src  
   cd ~/catkin_ws/src  
2.下载usb_cam包
git clone    https://github.com/bosch-ros-pkg/usb_cam.git usb_cam
 3.在catkin_ws中编译:
    $mkdir build
    $cd build
    $cmake ..
    $make
4.创建launch文件
<launch>
  <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
    <param name="video_device" value="/dev/video0" />
    <param name="image_width" value="640" />
    <param name="image_height" value="480" />
    <param name="pixel_format" value="mjpeg" />
    <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>
注意像素格式,有的可能是yuyv格式,需要做相应改动。
<param name="pixel_format" value="mjpeg" />改为: <param name="pixel_format" value="yuyv" />
写launch文件时写成txt格式,最后再更改类型为launch
5. 测试
qd@qd-virtual-machine:~/catkin_ws$ roslaunch usb_cam.launch
qd@qd-virtual-machine:/opt/ros/indigo$ rosrun image_view image_view image:= /usb_cam/image_raw
ROS usb_cam安装_第1张图片

你可能感兴趣的:(ROS usb_cam安装)