ros-drivers / usb_cam

A ROS Driver for V4L2 USB Cameras
https://ros-drivers.github.io/usb_cam/main/
Other
551 stars 596 forks source link

`yuyv2rgb` is unsupported/ segmentation fault after humble recent (?) upgrade for rpicamera #341

Open lmendyk opened 3 months ago

lmendyk commented 3 months ago

It worked some time ago for humble release ( https://github.com/ros-drivers/usb_cam/issues/299 ) After recent upgrade of pages I get:

This device supports the following formats:
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Specified format `**yuyv2rgb**` is unsupported by the selected device `/dev/video0`
[ros2run]: Aborted

But when for testing I specify for “test” I get:

This driver supports the following formats:
        rgb8
        yuyv
        **yuyv2rgb**
        uyvy
        uyvy2rgb
        mono8
        mono16
        y102mono8
        raw_mjpeg
        mjpeg2rgb
        m4202rgb
terminate called after throwing an instance of 'std::invalid_argument'
  what():  Specified format `test` is unsupported by this ROS driver

After experimenting and adding av_device_format:="YVYU" it gets even worse:

[INFO] [1723628892.506987172] [usb_cam]: Starting 'default_cam' (/dev/video0) at 640x480 via mmap (yuyv2rgb) at 30 FPS
[ros2run]: Segmentation fault

The camera supports:

v4l2-ctl --list-formats-ext -d /dev/video0
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'YU12' (Planar YUV 4:2:0)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [1]: 'YUYV' (YUYV 4:2:2)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [2]: 'RGB3' (24-bit RGB 8-8-8)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [3]: 'JPEG' (JFIF JPEG, compressed)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [4]: 'H264' (H.264, compressed)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [5]: 'MJPG' (Motion-JPEG, compressed)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [6]: 'YVYU' (YVYU 4:2:2)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [7]: 'VYUY' (VYUY 4:2:2)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [8]: 'UYVY' (UYVY 4:2:2)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [9]: 'NV12' (Y/CbCr 4:2:0)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [10]: 'BGR3' (24-bit BGR 8-8-8)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [11]: 'YV12' (Planar YVU 4:2:0)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [12]: 'NV21' (Y/CrCb 4:2:0)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2
        [13]: 'RX24' (32-bit XBGR 8-8-8-8)
                Size: Stepwise 32x32 - 3280x2464 with step 2/2

I don't know what to do to make the camera work again.

flynneva commented 2 months ago

@lmendyk what image format are you trying to use? What image format do you want this driver to publish with?

lmendyk commented 2 months ago

YUYV to RGB with compression - that is what I have been using so far and now it hast stop working.

The situation that system first reports " Specified format yuyv2rgb is unsupported" but when testing it prints: This driver supports the following formats: ...yuyv2rgb, does not help me to understand what is going on.