ros-drivers / libuvc_ros

http://www.ros.org/wiki/libuvc_ros
81 stars 97 forks source link

uvc_get_stream_ctrl_format_size: Invalid mode (-51) #37

Open ppm-tahi opened 7 years ago

ppm-tahi commented 7 years ago

Hi,

I am trying to use a Logitech c920 Pro camera in ROS. I installed everything, usb_cam driver is working fine, but the FPS is low. I have some issues with libuvc_ros with the camera. It is working with the attached launch file, but I can not increase the FPS for fullhd resolution. The supported modes is in this file: modes.txt

It is working only if the video_mode is uncompressed or yuyv and the frame_rate is 5. In the modes, I can see jpeg video_mode, where the frame_rate is 30, but if I try to set it up, I get -51 error.

Where should I search for the problem?

Launch file:

<launch>
  <group ns="camera">
    <node pkg="libuvc_camera" type="camera_node" name="c920">
      <!-- Parameters used to find the camera -->
      <param name="vendor" value="0x046d"/>
      <param name="product" value="0x082d"/>
      <param name="serial" value="1"/>
      <!-- If the above parameters aren't unique, choose the first match: -->
      <param name="index" value="0"/>

      <!-- Image size and type -->
      <param name="width" value="1920"/>
      <param name="height" value="1080"/>
      <!-- choose whichever uncompressed format the camera supports: -->
      <param name="video_mode" value="uncompressed"/> <!-- or yuyv/nv12/jpeg -->
      <param name="frame_rate" value="5"/>

      <param name="timestamp_method" value="start"/> <!-- start of frame -->
      <param name="camera_info_url" value="file:///home/ubuntu/src/libuvc/cameras/logitech_hd_pro_920.txt"/>

      <param name="auto_exposure" value="3"/> <!-- use aperture_priority auto exposure -->
      <param name="auto_white_balance" value="false"/>
    </node>
  </group>
</launch>
ppm-tahi commented 7 years ago

Anyone?

robosherpa commented 7 years ago

Hi ppm-tahi, Have you found a fix to your problem yet? I am going through the same issue with a webcam on macbook.

ppm-tahi commented 7 years ago

Hi bikramA,

no, to be honest, I was not searching for a solution since then.

Balint

robosherpa commented 7 years ago

Thanks Balint, Just in case someone runs into this issue again, here is a launch that worked for me with the same error. I lowered the resolution and changed video mode to uncompressed.

Cheers, BK

<launch>
  <group ns="camera">
    <node pkg="libuvc_camera" type="camera_node" name="mycam">
      <!-- Parameters used to find the camera -->
      <param name="vendor" value="0x046d"/>
      <param name="product" value="0x0825"/>
      <param name="serial" value=""/>
      <!-- If the above parameters aren't unique, choose the first match: -->
      <param name="index" value="0"/>

      <!-- Image size and type -->
      <param name="width" value="640"/>
      <param name="height" value="480"/>
      <!-- choose whichever uncompressed format the camera supports: -->
      <param name="video_mode" value="uncompressed"/> <!-- uncompressed/yuyv/nv12/jpeg -->
      <param name="frame_rate" value="30"/>

      <param name="timestamp_method" value="start"/> <!-- start of frame -->
      <param name="camera_info_url" value="file:///home/usr/.ros/camera_info/calibration.txt"/>

      <param name="auto_exposure" value="1"/> <!-- use aperture_priority auto exposure -->
      <param name="auto_white_balance" value="true"/>
      <remap from="/camera/image_raw/compressed" to="/compressed_image" />
    </node>
  </group>
</launch>
ppm-tahi commented 7 years ago

In 640x480 it was working for me as well, but not on higher resolution.

subhaya commented 7 years ago

you have to check v4l2-ctl --list-formats-ext for acceptable formats which is compatible with your device.

rnunziata commented 6 years ago

I am getting the same error...the odd think is that it was working at some point....now no matter what I pass it error -51 invalid mode

davelkan-zz commented 6 years ago

Same. Even when using supposedly supported formats error -51 invalid mode

davelkan-zz commented 6 years ago

when running v4l2-ctl --list-formats-ext make sure the format you're using matches video_mode/width/height and frame_rate. I was using a bad framerate.

7675t commented 6 years ago

I believe MJPEG support of libuvc_camera enabled in Lunar released package. See #43 . If you have problem in the released package, inform me here.

Please notice libuvc_camera in Indigo, Jade and Kinetic doesn't support MJPEG. If you need to use it in these distro, I think you need to build it from source code.

And lastly, please notice the video_mode should be 'mjpeg', not 'jpeg'

 <param name="video_mode" value="mjpeg"/>
seiya0412 commented 6 years ago

I'm not sure if it helps or not, but in my case, my monochrome camera (gray8 format) sends format code 'Y','8',' ',' ' instead of 'Y','8','0','0' which is defined in frame.c in original libuvc repository (Note that it is NOT libuvc_ros repo).

I modified the line, compiled libuvc from the source, purge ros-kinetic-libuvc*, and then this invalid mode error disappeared. https://github.com/seiya0412/libuvc/commit/e1e950a86b92be91e811fbcffe5e12c45c09c109