libuvc_camera启动报错Invalid mode问题的解决办法

libuvc_cameraROS下的一个软件包,用于将USB摄像头的视频内容发布到Topic上,但是启动时

roslaunch uvc.launch

经常会遇到以下报错:

process[camera/mycam-1]: started with pid [4578]
unsupported descriptor subtype VS_COLORFORMAT
unsupported descriptor subtype VS_COLORFORMAT
uvc_get_stream_ctrl_format_size: Invalid mode (-51)
[ERROR] [1578882156.980703592]: check video_mode/width/height/frame_rate are available
DEVICE CONFIGURATION (0000:0000/[none]) ---
Status: idle
VideoControl:
	bcdUVC: 0x7273
[camera/mycam-1] process has died [pid 4578, exit code -11, cmd /opt/ros/kinetic/lib/libuvc_camera/camera_node __name:=mycam __log:=/home/jeffrey2019/.ros/log/b6a4ed00-35a9-11ea-be20-000c297f47e8/camera-mycam-1.log].
log file: /home/jeffrey2019/.ros/log/b6a4ed00-35a9-11ea-be20-000c297f47e8/camera-mycam-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done

其中

uvc_get_stream_ctrl_format_size: Invalid mode (-51)

给出了报错的关键,指定的工作模式不被摄像头支持,必须找到一种被支持的模式才行
对于我的戴尔G3 3579笔记本摄像头,我并不知道它支持哪些模式,只好不断试错,最终发现这种可以:

<launch>
  <group ns="camera">
    <node pkg="libuvc_camera" type="camera_node" name="mycam">
      <!-- Parameters used to find the camera -->
      <param name="vendor" value="0x0bda"/>
      <param name="product" value="0x568a"/>
      <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"/> <!-- 640 -->
      <param name="height" value="480"/> <!-- 480 -->
      <!-- choose whichever uncompressed format the camera supports: -->
      <param name="video_mode" value="uncompressed"/> <!-- or yuyv/nv12/mjpeg -->
      <param name="frame_rate" value="30"/>

      <param name="timestamp_method" value="start"/> <!-- start of frame -->
      <param name="camera_info_url" value="file:///tmp/cam.yaml"/>

      <param name="auto_exposure" value="3"/> <!-- use aperture_priority auto exposure -->
      <param name="auto_white_balance" value="false"/>
    </node>
  </group>
</launch>

试错区域集中在Image size and type区段,包括widthheightvideo_modeframe_rate,每一个参数都必须调整到摄像头恰好支持的配置,不能高也不能低,例如frame_rate,目前大多数摄像头都有30,那么libuvc_camera的wiki页面上的默认取值15就是不对的。

试错成功后,启动下面命令行,就能看到视频流:

rosrun image_view image_view image:=/camera/image_raw

通过image_view查看libuvc_camera串流

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值