Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

uvc_get_stream_ctrl_format_size: Invalid mode (-51) #37

Open
ppm-tahi opened this issue Dec 13, 2016 · 11 comments
Open

uvc_get_stream_ctrl_format_size: Invalid mode (-51) #37

ppm-tahi opened this issue Dec 13, 2016 · 11 comments

Comments

@ppm-tahi
Copy link

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
Copy link
Author

ppm-tahi commented Jan 2, 2017

Anyone?

@robosherpa
Copy link

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
Copy link
Author

Hi bikramA,

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

Balint

@robosherpa
Copy link

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
Copy link
Author

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

@subhaya
Copy link

subhaya commented May 8, 2017

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

@rnunziata
Copy link

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
Copy link

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

@davelkan-zz
Copy link

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
Copy link
Contributor

7675t commented Nov 2, 2017

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
Copy link

seiya0412 commented Apr 25, 2018

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.
seiya0412/libuvc@e1e950a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants