sbrodeur / ros-icreate-bbb

ROS (Robotic Operating System) packages for the iRobot Create with onboard BeagleBone Black
BSD 3-Clause "New" or "Revised" License
3 stars 2 forks source link

Increase frame rate of video cameras #33

Closed sbrodeur closed 7 years ago

sbrodeur commented 7 years ago

The webcams should be able to stream at 30 fps (see http://dslrmodifications.com/Pro9000a.html), but this seems limited to about 13 fps for some reasons. Decreasing the resolution or exposure time doesn't seem to make higher the frame rate, which is a problem. Maybe this is only for RAW encoding and not MJPEG.

sbrodeur commented 7 years ago

Here they test the Logitech Quickcam 9000 Pro using various camera drivers from ROS: http://www.iheartrobotics.com/2010/05/testing-ros-usb-camera-drivers.html

I get very similar results on the robot: 30 fps at 320x240 resolution, and 20 fps at 640x480 resolution.

sbrodeur commented 7 years ago

Modifying the usb_cam package to allow for MJPEG pass-through seems to work and produce streams at faster framerate, but somehow I get corrupted images frequently (if not consistently) when I try to view the images with the viewer node. The problem is solved when requesting only a single buffer from the camera, but then the framerate drops from 30 fps to 15 fps.

Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: 13 extraneous bytes before marker 0xd9
Corrupt JPEG data: premature end of data segment
Corrupt JPEG data: premature end of data segment

Possible solution:

sbrodeur commented 7 years ago

This was due to a bug (typo) in handling the buffers. This is now fixed and working. See commit e5b8a10 for the changes made to usb_cam package. It is now possible to stream images from both cameras simultaneously at 30 fps for 640x480 resolution.

Now, it seems that the cameras are sometime badly closed, and they fail to be opened again without reloading the driver:

rmmod uvcvideo
modprobe uvcvideo
sbrodeur commented 7 years ago

Testes now with the launch script ros.sh and the cameras closed properly. It seems that configuring the cameras to manual mode before launching the nodes may be the important thing that helps to avoid device errors.