How can I increase the frame rate of my USB camera?
I am using the ros-kinetic-usb-cam package as the driver for my USB camera.
The specs of the camera I am using are as follows are as follows:
Sensor 1/4 CMOS
Resolution 640HX480V
Picture Forma VGA
Data Format YUY2
Interface USB2.0
Frames/S 30fps (VGA), 15fps (XVGA)
Here are the parameters I am passing to the usb_cam-test.launch file.
image_view/autosize: True
rosdistro: kinetic
rosversion: 1.12.14
usb_cam/camera_frame_id: usb_cam
usb_cam/image_height: 480
usb_cam/image_width: 640
usb_cam/io_method: mmap
usb_cam/pixel_format: yuyv
usb_cam/video_device: /dev/video2
When running the usb_cam-test.launch file it shows the following message -
Starting 'head_camera' (/dev/video2) at 640x480 via mmap (yuyv) at 30 FPS
But when I check the publish rate of "/usb_cam/image_raw" it shows a value close to 8 which I am expecting to be around 30.
Why am I not able to get a higher frame rate? How can I fix it?
Could it be because of my machine? I am using a Dell Inspiron 5520 laptop with Intel i5.
Hi @sohambhave1998,
Since you are not passing any custom parameters the node will take its default parameter value. From this line I can see that it is 30, thus the node will publish the image at 30Hz. ros::Rate is a convenience class which makes a best effort at maintaining a particular rate for a loop.
Since you are saying that rate is unable to keep up with the images processed by the sensor, it sound to me like you have a bottleneck in your set up. Maybe you are correct and your computer is not enough to publish at that rate. Have you tried it in another machine? Just to be sure.
Another thing can be the rate at which the USB connector transfer data, maybe is an old connector or has a defect.