ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Setting a USB camera in ROS

asked 2017-09-27 13:50:43 -0500

cesarPR gravatar image

updated 2017-09-28 17:41:26 -0500

Hello,

First of all i wanna say that i'm really really new at ROS, I basiclly just started and so I don't know even all the commands and functionalities that there is. So I apolagize if I make really stupid questions.

I'm trying to use a USB camera, i have a HP HD 4310. I installed 'cheese' and ran it and could see the output from the camera, so i know the camera is linked just fine. After that i tried to install it in ROS, and that's where the problems started. After some research i followed some steps, and this like this:

sudo apt-get install ros-indigo-uvc-camera

Afterwards also tried:

sudo apt-get install ros-indigo-cv-camera

sudo apt-get install ros-indigo-libuvc-camera

I also went to /dev and saw that my camera was in /dev/video1.

After that i tried to initialize the camera, by doing:

rosrun uvc_camera uvc_camera_node _device:=/dev/video1

But i get the following messages:

[ INFO] [1506553332.714160099]: using default calibration URL
[ INFO] [1506553332.714246140]: camera calibration URL: file:///home/cesar/.ros/camera_info/camera.yaml
[ INFO] [1506553332.714315848]: Unable to open camera calibration file [/home/cesar/.ros/camera_info/camera.yaml]
[ WARN] [1506553332.714344759]: Camera calibration file /home/cesar/.ros/camera_info/camera.yaml not found.
opening /dev/video1
pixfmt 0 = 'YUYV' desc = 'YUYV 4:2:2'
  discrete: 640x480:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 160x120:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 176x144:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 320x240:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 352x288:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 424x240:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 640x360:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 800x448:   1/20 1/15 1/10 2/15 
  discrete: 800x600:   1/15 1/10 2/15 
  discrete: 848x480:   1/15 1/10 2/15 
  discrete: 960x540:   1/15 1/10 2/15 
  discrete: 960x720:   1/15 1/10 2/15 
  discrete: 1280x720:   2/15 
  discrete: 1920x1080:   1/5 
  discrete: 640x480:   1/30 1/25 1/20 1/15 1/10 2/15 
pixfmt 1 = 'MJPG' desc = 'Motion-JPEG'
  discrete: 640x480:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 160x120:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 176x144:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 320x240:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 352x288:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 416x240:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 640x360:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 800x448:   1/30 1/25 1/20 1/15 1/10 2/15 
  discrete: 800x600:   1 ...
(more)
edit retag flag offensive close merge delete

Comments

2

Try rosrun uvc_camera uvc_camera_node _device:=/dev/video1 (added _ before device, since it's a private parameter and not topic)

ahendrix gravatar image ahendrix  ( 2017-09-27 15:26:15 -0500 )edit

Hi @ahendrix, thanks for that observation, in fact that was something i was doing wrong. Please re read my post as i edited it with the new result after I corrected that

cesarPR gravatar image cesarPR  ( 2017-09-27 18:09:38 -0500 )edit

@ahendrix, please check the new information that i added

cesarPR gravatar image cesarPR  ( 2017-09-28 11:26:00 -0500 )edit

It looks like you have the parameters right now, and the node is crashing. I don't know enough about the specifics of the uvc_camera node to know why it might be crashing.

ahendrix gravatar image ahendrix  ( 2017-09-28 14:19:04 -0500 )edit

Try out http://wiki.ros.org/usb_cam ( _video_device:=/dev/video1, the parameters are named different)- it's possible with either package that the default pixel format doesn't work (perhaps to the point of crashing), and you should try the other ones. Does /dev/video0 (your laptop camera?) work?

lucasw gravatar image lucasw  ( 2017-09-28 22:18:55 -0500 )edit

How can i install that package usb_cam @lucasw ? That website on wiki only has the code on github. How do i install it? If i try doing "rosrun uvc_camera uvc_camera_node _device.=/dev/video0" gives the exact same messages.

cesarPR gravatar image cesarPR  ( 2017-09-29 10:19:33 -0500 )edit

Another thing that i saw is that by doing "rosrun rqt_image_view rqt_image_view" it only gives me the image of the internal pc camera, and not my USB camera. Although when i do "cheese" wich is a program to see streaming output from a camera it gives me the image of the usb camera..

cesarPR gravatar image cesarPR  ( 2017-09-29 10:21:29 -0500 )edit

If you can see the image in rqt_image_view that means the node is working? Or does it only do a few frames then dies? /dev/video0 is likely your internal camera, and /dev/video1 is what you plugged in - it is worth trying different cameras to see if the problem is with the camera or elsewhere.

lucasw gravatar image lucasw  ( 2017-09-29 11:23:00 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-09-30 07:22:04 -0500

cesarPR gravatar image

So i managed to get this working. The error was because i hadn't calibrated the camera yet, and so there was no calibration file on that path "/home/cesar/.ros/camera_info/camera.yaml".

After i calibrated following http://wiki.ros.org/camera_calibratio... all started to work.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-09-27 13:50:43 -0500

Seen: 11,369 times

Last updated: Sep 30 '17