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

usb_cam pkg gives garbled green screen

asked 2019-06-12 16:00:19 -0500

STrobotics gravatar image

I have a ROS kinetic on my virtualbox. I tried to use "usb_cam" pkg but it doesn't work. My web cam is connected directly to my PC and I can see the video through "cheese" or "camorama" but when I run usb_cam pkg, I get garbled green screen both on "image_view" or directly on "rviz" for image_raw. I tried both yuyv and jpeg for pixel format but it doesn't work. Any suggestions ?

edit retag flag offensive close merge delete

Comments

Is your camera connected as multiple devices? When I plug in my webcam and run guvcview, I get two devices named the same thing, but one produces a garbled green picture while the other is normal. In Ubuntu (if that's what you're using), you can get a list of video devices with:

ls -ltrh /dev/video*

With only the webcam connected, I get:

crw-rw----+ 1 root video 81, 1 Jun 20 11:44 /dev/video1
crw-rw----+ 1 root video 81, 0 Jun 20 11:44 /dev/video0

Furthermore, I can stream one (the normal one) directly into ROS using the video_stream_opencv package, but the garbled one throws an error. Can you confirm that you're using the correct device?

tryan gravatar image tryan  ( 2019-06-20 10:54:50 -0500 )edit

Exactly the same, I can get stream using video_stream_opencv but not usb_cam pkg. As you mentioned, I changed the video devices in the usb_cam launch file. I'm getting garbled green screen for /dev/video0 and "No image" for /dev/video1 when I'm looking at image_raw through rviz.

STrobotics gravatar image STrobotics  ( 2019-06-20 13:25:23 -0500 )edit

Does usb_cam throw any errors when trying to connect to the "normal" stream? Can you see output on the topic using rostopic echo?

tryan gravatar image tryan  ( 2019-06-21 09:41:29 -0500 )edit

There is no error, the output of rostopic echo is normal(big matrix). It is weird that rviz can't display the image

STrobotics gravatar image STrobotics  ( 2019-06-26 09:52:58 -0500 )edit

Wait a second, it sounds like the output of rostopic echo doesn't change even if I cover the camera. It looks like it's the garbled green screen pixels

STrobotics gravatar image STrobotics  ( 2019-06-26 10:01:08 -0500 )edit

Have you used rqt_graph to make sure the topics are connected?

tryan gravatar image tryan  ( 2019-06-28 09:24:39 -0500 )edit

Did you solve that issue, I'm in the same problem, and don't know how to fix it

quyetbui gravatar image quyetbui  ( 2021-08-04 05:08:46 -0500 )edit
1

If someone was able to solve this then please let me know, facing this smae issue.

Victor_Kash gravatar image Victor_Kash  ( 2021-08-16 13:08:25 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-01-08 03:56:08 -0500

I had the same issue, to solve it you need to do the following: 1- check the output type format for the USB camera you're working with. 2- Mine was mjpeg so I had to modify the usb_cam-test.launch which can be found under the following directory: /opt/ros/noetic/share/usb_cam/launch/usb_cam-test.launch 3- Change "yuyv" to "mjpeg" in the launch file 4- Run the following node rosrun usb_cam usb_cam_node _pixel_format:=mjpeg 5- It should be working well right now. You can double-check by doing: rosrun image_view image_view image:=/usb_cam/image_raw

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-06-12 16:00:19 -0500

Seen: 1,095 times

Last updated: Jun 12 '19