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: VIDIOC_ENUM_FMT 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 usb_cam usb_cam-test.launch _device_name:=/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
- /image_view/autosize: True
- /rosdistro: noetic
- /rosversion: 1.15.14
- /usb_cam/camera_frame_id: usb_cam
- /usb_cam/image_height: 720
- /usb_cam/image_width: 1280
- /usb_cam/io_method: mmap
- /usb_cam/pixel_format: mjpeg
- /usb_cam/video_device: /dev/video0
NODES / image_view (image_view/image_view) usb_cam (usb_cam/usb_cam_node)
ROS_MASTER_URI=http://localhost:11311
process[usb_cam-1]: started with pid [2886]
process[image_view-2]: started with pid [2887]
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.
I listed the available devices using the command v4l2-ctl --list-devices and tried changing the device names but no change in the output.
I came across a possible fix for this problem as mentioned in: https://github.com/ros-drivers/usb_ca..., but I don't have usb_cam/src/usb_cam.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.