Problems running web-cam with ROS

2,857 views
Skip to first unread message

Cactus Jack

unread,
Jan 9, 2016, 10:54:22 PM1/9/16
to ros-by-example
I am trying to run my web-cam with ROS-Hydro.  It works fine with gucview.  I have installed usb_cam.  When I try to run rosrun usb_cam usb_cam_node this is what I get:

brent@brent:~$ rosrun usb_cam usb_cam_node
[ INFO] [1452397963.756658751]: using default calibration URL
[ INFO] [1452397963.756899975]: camera calibration URL: file:///home/brent/.ros/camera_info/head_camera.yaml
[ INFO] [1452397963.757137391]: Unable to open camera calibration file [/home/brent/.ros/camera_info/head_camera.yaml]
[ WARN] [1452397963.757244560]: Camera calibration file /home/brent/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1452397963.757353586]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (mjpeg) at 30 FPS
[ WARN] [1452397969.604862084]: white_balance_temperature_auto: Input/output error
VIDIOC_S_CTRL: failed: Input/output error

[ WARN] [1452397969.613533452]: unknown control 'focus_auto'

Hopefully I have given enough information. 

Thanks for your help,
Cactus


Patrick Goebel

unread,
Jan 12, 2016, 10:00:00 AM1/12/16
to ros-by-...@googlegroups.com
Hi Catcus,

Even though you get that error, do you see an image when running image_view?  Also, you might want to try the following launch file instead of running the node directly.  This is the launch file we use in ROS By Example Volume 1.

<launch>
    <arg name="video_device" default="/dev/video0" />

    <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" clear_params="true" output="screen">
   
        <remap from="usb_cam/image_raw" to="/camera/rgb/image_raw" />
        <remap from="usb_cam/camera_info" to="/camera/rgb/camera_info" />

        <param name="video_device" value="$(arg video_device)" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="framerate" value="30" />
        <param name="pixel_format" value="mjpeg" />
        <param name="contrast" value="32" />
        <param name="brightness" value="32" />
        <param name="saturation" value="32" />
        <param name="autofocus" value="true" />
        <param name="camera_frame_id" value="camera_link" />
       
    </node>
</launch>


--patrick

B Lamb

unread,
Jan 12, 2016, 12:40:58 PM1/12/16
to ros-by-...@googlegroups.com
Thanks Patrick for your quick response.  No I don't get any image.

Thanks,
Cactus


--
You received this message because you are subscribed to a topic in the Google Groups "ros-by-example" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ros-by-example/-BspcwcqKfg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ros-by-exampl...@googlegroups.com.
Visit this group at https://groups.google.com/group/ros-by-example.
For more options, visit https://groups.google.com/d/optout.


B Lamb

unread,
Jan 12, 2016, 2:50:53 PM1/12/16
to ros-by-...@googlegroups.com
Patrick,
This is what I get when I run the launch file:

brent@brent:~/catkin_ws/src/rbx1/rbx1_vision$ roslaunch rbx1_vision usb_cam.launch device:=/dev/video0
... logging to /home/brent/.ros/log/48ed9f98-b955-11e5-a5ff-00123fafd8db/roslaunch-brent-7581.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://brent:58130/

SUMMARY
========

CLEAR PARAMETERS
 * /usb_cam/

PARAMETERS
 * /rosdistro
 * /rosversion
 * /usb_cam/autofocus
 * /usb_cam/brightness
 * /usb_cam/camera_frame_id
 * /usb_cam/contrast
 * /usb_cam/framerate
 * /usb_cam/image_height
 * /usb_cam/image_width
 * /usb_cam/pixel_format
 * /usb_cam/saturation
 * /usb_cam/video_device

NODES
  /
    usb_cam (usb_cam/usb_cam_node)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
process[usb_cam-1]: started with pid [7600]
[ INFO] [1452627604.392043199]: using default calibration URL
[ INFO] [1452627604.392285220]: camera calibration URL: file:///home/brent/.ros/camera_info/head_camera.yaml
[ INFO] [1452627604.392520131]: Unable to open camera calibration file [/home/brent/.ros/camera_info/head_camera.yaml]
[ WARN] [1452627604.392630203]: Camera calibration file /home/brent/.ros/camera_info/head_camera.yaml not found.
[ INFO] [1452627604.392738474]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (mjpeg) at 30 FPS
[ WARN] [1452627605.193629709]: brightness: Input/output error
VIDIOC_S_CTRL: failed: Input/output error

[ WARN] [1452627605.801576873]: contrast: Input/output error
VIDIOC_S_CTRL: failed: Input/output error

[ WARN] [1452627605.964538059]: saturation: Input/output error
VIDIOC_S_CTRL: failed: Input/output error

[ INFO] [1452627606.051559488]: V4L2_CID_FOCUS_AUTO is not supported
[ WARN] [1452627606.060551636]: unknown control 'focus_auto'


Cactus

Patrick Goebel

unread,
Jan 13, 2016, 9:25:51 AM1/13/16
to ros-by-...@googlegroups.com
Hi Catcus,

It's possible your camera is not compatible with the usb_cam package but have you tried the launch file I included in my earlier message?  If it works, the camera image should be on the topic /camera/rgb/image_raw so after running the launch file, test the video stream with:

$ rosrun image_view image_view image:=/camera/rgb/image_raw

If this still doesn't work, I would suggest posting on http://answers.ros.org and include the following:
  • your camera make and model
  • your version of ROS
  • your version of Ubuntu
  • what kind of computer you are running on (e.g. laptop versus Raspberry Pi)

--patrick

You received this message because you are subscribed to the Google Groups "ros-by-example" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ros-by-exampl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages