Ask Your Question
1

Issue with usb_cam, can't open camera

asked 2012-09-03 06:34:24 -0600

lanray gravatar image

updated 2014-01-28 17:13:32 -0600

ngrennan gravatar image

I wanna to test whether this usb_cam works. But get the error below. Anyone can help? THX!!

@Laptop:~/ros_workspace/usb_cam$ roslaunch usb_cam-test.launch
... logging to /home/lanray/.ros/log/cb16e5d0-f5e3-11e1-bc19-001e64868dfe/roslaunch-Laptop-18031.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 <a href="http://Laptop:56876/">http://Laptop:56876/</a>

SUMMARY
========

PARAMETERS
 * /image_view/autosize
 * /rosdistro
 * /rosversion
 * /usb_cam/camera_frame_id
 * /usb_cam/image_height
 * /usb_cam/image_width
 * /usb_cam/io_method
 * /usb_cam/pixel_format
 * /usb_cam/video_device

NODES
  /
    image_view (image_view/image_view)
    usb_cam (usb_cam/usb_cam_node)

ROS_MASTER_URI=http://localhost:11311

core service [/rosout] found
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[usb_cam-1]: started with pid [18051]
Exception AttributeError: AttributeError("'_DummyThread' object has no attribute '_Thread__block'",) in <module 'threading' from '/usr/lib/python2.7/threading.pyc'> ignored
process[image_view-2]: started with pid [18062]
usb_cam video_device set to [/dev/video0]
usb_cam io_method set to [mmap]
usb_cam image_width set to [640]
usb_cam image_height set to [480]
usb_cam pixel_format set to [mjpeg]
usb_cam auto_focus set to [0]
VIDIOC_S_FMT error 22, Invalid argument
[usb_cam-1] process has died [pid 18051, exit code 1, cmd /home/lanray/ros_workspace/usb_cam/bin/usb_cam_node __name:=usb_cam __log:=/home/lanray/.ros/log/cb16e5d0-f5e3-11e1-bc19-001e64868dfe/usb_cam-1.log].
log file: /home/lanray/.ros/log/cb16e5d0-f5e3-11e1-bc19-001e64868dfe/usb_cam-1*.log
edit retag flag offensive close merge delete

Comments

please post questions with useful titles and useful tags so that others can learn from your issues too.

Kevin gravatar imageKevin ( 2012-09-03 06:47:30 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
6

answered 2012-09-03 07:19:22 -0600

Hi there,

I have had a similar error some time back and I decided to google for the right solution before posting my own question. Fortunately, I got the answer straight and simple from the following link:

ROS Answers

However, to simply state the solution here all you have to do is to set the parameter pixel_format to 'yuyv' from its default value of 'mjpeg'

This could be done in the terminal by executing the following line before executing the 'rosrun' command:

rosparam set /usb_cam/pixel_format yuyv

and then,

rosrun usb_cam usb_cam_node

I have used this with several webcam and it worked fine in all of them. You may even make a launch file with this parameter set to 'yuyv' so that you need not repeat the command everytime you run usb_cam_node.

Am sure this will work.

Good luck with your task to achieve.

Regards,

edit flag offensive delete link more

Comments

To have an even more convenient way to handle this, you could create a small custom launch file for usb_cam that sets this parameter.

Christoph gravatar imageChristoph ( 2013-11-01 23:15:25 -0600 )edit

how to set the parameter in a launch file @Christoph ?

I tried this, but it didn't work:

  <param name="/usb_cam/pixel_format" value="yuyv"/>
rflmota gravatar imagerflmota ( 2014-09-20 19:17:34 -0600 )edit

I have tried this solution however the problem still occurs sometimes. The camera is used for tracking an April Tag on the quad-copter and it is dangerous when the camera node suddenly stops working in the middle of flight. I am using Logitech Pro 9000 PC Internet Camera Webcam. Alternate solution?

aorait gravatar imageaorait ( 2016-03-21 13:55:07 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-09-03 06:34:24 -0600

Seen: 7,612 times

Last updated: Oct 31 '13