Skip to content →

How To: USB Web Cam with ROS Indigo

There’s no clear instructions for how to actually get your usb webcam image in ROS.

Steps:

1. Install usb_cam ros package ($sudo apt-get install ros-indigo-usb-cam)

2. Create a launch file. Visit this link for launch file and instructions.

3. Then $ roslaunch usb_cam-test.launch

Published in Research Tutorial

8 Comments

  1. P Kishore Kumar P Kishore Kumar

    I tried this tutorial with my logitech E2500 quickcam. I am getting the following error.

    [ INFO] [1435745300.104515727]: using default calibration URL
    [ INFO] [1435745300.104758956]: camera calibration URL: file:///home/robotics/.ros/camera_info/head_camera.yaml
    [ INFO] [1435745300.104896909]: Unable to open camera calibration file [/home/robotics/.ros/camera_info/head_camera.yaml]
    [ WARN] [1435745300.104989836]: Camera calibration file /home/robotics/.ros/camera_info/head_camera.yaml not found.
    [ INFO] [1435745300.105081596]: Starting ‘head_camera’ (/dev/video0) at 640×480 via mmap (yuyv) at 30 FPS
    [ INFO] [1435745300.287583635]: Press ‘q’ on the window to stop the node
    [ WARN] [1435745302.024780786]: unknown control ‘white_balance_temperature_auto’

    [ WARN] [1435745302.030843629]: unknown control ‘focus_auto’

    [usb_cam-1] process has died [pid 11268, exit code -11, cmd /opt/ros/indigo/lib/usb_cam/usb_cam_node __name:=usb_cam __log:=/home/robotics/.ros/log/0dbb282a-1fd4-11e5-9a70-00270e30caa5/usb_cam-1.log].
    log file: /home/robotics/.ros/log/0dbb282a-1fd4-11e5-9a70-00270e30caa5/usb_cam-1*.log
    Can you clarify me this error.

    • sauravagarwal sauravagarwal

      If you look at the console log carefully, your camera calibration file is missing. Try calibrating your camera and setting the right path for your calibration (.yml) file. See if that solves your problem. You should also read the full log file (the path at the end of the message).

    • Maih Maih

      hello,i have the same problem,can you tell me how to solve it?

  2. I found this to helped “http://answers.ros.org/question/9098/usb_cam-vidioc_s_fmt-error-22/”.
    I was having issues getting the test to run but once I changed the pixel format from mjpeg to yuyv it was good.

    • sauravagarwal sauravagarwal

      Thanks for sharing the tip Dave 🙂

    • Michael Wolfram Michael Wolfram

      This did also work for me! Thanks!

  3. soheila soheila

    Hi, when I execute roslaunch usb_cam-text.launch my built-in webcam starts working instead of my external working? Why it happens?Moreover, I run cheese my external webcam turns on!!

    • sauravagarwal sauravagarwal

      It probably has something to with your device ID that you put in the launch file. Use lspci / lsusb to see which device your external camera is. Should be something like /dev/videoxx
      You can also use $ v4l2-ctl –list-devices

Leave a Reply

Your email address will not be published. Required fields are marked *