Robotics StackExchange | Archived questions

Outbuf size mismatch usb_cam

I am using an usb camera whose pixel format is mjpeg as shown below:

v4l2-ctl --device=0 --list-formats-ext

ioctl: VIDIOCENUMFMT Type: Video Capture

[0]: 'MJPG' (Motion-JPEG, compressed)
    Size: Discrete 1920x1080
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.050s (20.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
        Interval: Discrete 0.100s (10.000 fps)
        Interval: Discrete 0.200s (5.000 fps)
    Size: Discrete 640x480
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.050s (20.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
        Interval: Discrete 0.100s (10.000 fps)
        Interval: Discrete 0.200s (5.000 fps)
    Size: Discrete 1280x720
        Interval: Discrete 0.033s (30.000 fps)
        Interval: Discrete 0.040s (25.000 fps)
        Interval: Discrete 0.050s (20.000 fps)
        Interval: Discrete 0.067s (15.000 fps)
        Interval: Discrete 0.100s (10.000 fps)
        Interval: Discrete 0.200s (5.000 fps)

When I launch the usb_cam-test.launch, I get outbuf size mismatch error. Shown below is the error and the launch file used.

roslaunch usbcam usbcam-test.launch devicename:=/dev/video0

... logging to /home/adharsh/.ros/log/fdbe4d06-2220-11ed-a10d-fb1009fee228/roslaunch-adharsh-VirtualBox-2872.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://adharsh-VirtualBox:46351/

SUMMARY

PARAMETERS

NODES / imageview (imageview/imageview) usbcam (usbcam/usbcam_node)

ROSMASTERURI=http://localhost:11311

process[usb_cam-1]: started with pid [2886]

process[image_view-2]: started with pid [2887]

[ INFO] [1661176084.725190613]: Initializing nodelet with 1 worker threads.

[ INFO] [1661176085.077071800]: Using transport "raw"

[ INFO] [1661176085.283311517]: using default calibration URL

[ INFO] [1661176085.284133865]: camera calibration URL: file:///home/adharsh/.ros/camerainfo/headcamera.yaml

[ INFO] [1661176085.284384427]: Unable to open camera calibration file [/home/adharsh/.ros/camerainfo/headcamera.yaml]

[ WARN] [1661176085.284553252]: Camera calibration file /home/adharsh/.ros/camerainfo/headcamera.yaml not found.

[ INFO] [1661176085.284714828]: Starting 'head_camera' (/dev/video0) at 1280x720 via mmap (mjpeg) at 30 FPS

[ WARN] [1661176085.476595652]: unknown control 'whitebalancetemperature_auto'

[ WARN] [1661176085.480896165]: unknown control 'focus_auto'

[ERROR] [1661176086.138696525]: outbuf size mismatch. pic_size: 1382400 bufsize: 1843200

Shown below is the launch file used:

<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="1280" />

   <param name="image_height" value="720" />

   <param name="pixel_format" value="mjpeg" />

   <param name="camera_frame_id" value="usb_cam" />

   <param name="io_method" value="mmap"/>

</node>

    <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">

    <remap from="image" to="/usb_cam/image_raw"/>

    <param name="autosize" value="true" />

</node>

</launch>

When I try to run the image_view in ROS, I only get a black screen with no image.

I tried the possible fixes: 1. When I changed the pixel format from mjpeg to yuyv, I got a green garbled screen.

  1. I listed the available devices using the command v4l2-ctl --list-devices and tried changing the device names but no change in the output.

  2. I came across a possible fix for this problem as mentioned in: https://github.com/ros-drivers/usb_cam/issues/79, but I don't have usbcam/src/usbcam.cpp file in my usb_cam folder. I only have cmake, launch, package.xml.

I am using ROS Noetic in Ubuntu 20.04 Virtual box.

Thanks, Adharsh.

Asked by EvilGenius on 2022-08-22 09:27:45 UTC

Comments

Answers