# ROS Webcam Stream Really Slow

I am trying to stream the images from my camera to a VM via ROS. Here is my setup:

• Raspberry Pi 3B+ with Picamera v2. It is running ROS Noetic with cv_camera_node
• An Ubuntu 20.04.1 VM with ROS Noetic. I am reviewing the live stream using rosrun rqt_image_view rqt_image_view

When I tried this, the stream is really laggy and slow. I am barely getting 10 fps. I was able to do camera calibration with it but mapping with it will be really challenging. Is there any way to speed it up. Can I decrease the quality of the camera capture? Any help is truly appreciated.

Here is my launch file:

<launch>
<node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
<param name="video_device" value="/dev/video0" />
<param name="image_width" value="640" />
<param name="image_height" value="480" />
<param name="pixel_format" value="uyvy" />
<param name="camera_frame_id" value="camera" />
<param name="io_method" value="mmap"/>
<param name="framerate" value="30" />
<param name="autofocus" value="true" />
<param name="camera_name" value="camera" />

</node>
<node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
<remap from="image" to="/camera/image_raw"/>
<param name="autosize" value="true" />
</node>
</launch>
$$$$
`

## 3 Answers

What camera are you using? It might be helpful to know since the driver might be at fault here.
Also, any particular reason you are working with the cv_camera_node? usb_cam has worked much better for me in the past. It works with libusb rather than opencv which could also be a culprit here. In the end, you just get a sensor_msgs::Image with both packages. So it'd be worth a shot. You can also set a bunch of different parameters in the launch file itself. Maybe play around with those? Specifically the framerate and image width/height.

• I am using the following camera: th.bing.com/th/id/… Feb 12, 2021 at 16:03
• I can try that! Feb 12, 2021 at 16:04
• I tried the usb_cam package but it is still the same. Feb 12, 2021 at 22:45
• What's your image size/resolution? Feb 12, 2021 at 23:14
• My camera is 2K(16:9) at 30fps. I set it to 640x480 at 30fps. The pixel format is yuyv. I will attach the entire launch file above. Feb 13, 2021 at 0:09

If you are using the Raspberry Pi camera and not a USB camera, it is better to use this node: https://github.com/UbiquityRobotics/raspicam_node. This gave me really good speed.

The problem is that you are using VMWare. For some reason, when I used a physical machine with ROS and Ubuntu, it worked! Maybe there is a fix in VMWare. If anybody knows the solution, they are free to explain.