使用usb_cam节点

我使用ros-indigo和ubuntu 14.04。我用usb_cam从相机获取帧,但现在我不能完成相同的任务。如何在ROS上使用usb_cam节点?

如果我运行rosbuild_ws/package_dir$ roslaunch camera.launch命令,我得到以下的输出:

Unable to open camera calibration file [/home/user/.ros/camera_info/head_camera.yaml] 
[ WARN] [1436602681.552893640]: Camera calibration file /home/user/.ros/camera_info/head_camera.yaml not found. 
[ INFO] [1436602681.552918876]: Starting 'head_camera' (/dev/video0) at 640x480 via mmap (yuyv) at 30 FPS 
[ WARN] [1436602681.584193482]: unknown control 'white_balance_temperature_auto' 

[ WARN] [1436602681.587047162]: unknown control 'focus_auto' 

处理这些错误&警告,我尝试安装usb_Cam。我跑rosdep install usb_cam,终端说#All required rosdeps installed successfully。我使用roscd usb_cam转到usb_cam文件夹。

然后我运行下面的命令:

/opt/ros/indigo/share/usb_cam$ rosmake usb_cam 
No Makefile in package usb_cam 
[ rosmake ]   Results:                
[ rosmake ] Built 39 packages with 0 failures.         
[ rosmake ] Summary output to directory 

最后,我跑rosbuild_ws/package_dir$ roslaunch camera.launch,但我得到同样的消息。我无法看到从usb相机拍摄的画面。如何使用usb_cam从usb cam获取帧? camera.launch的

内容:

<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="640" /> 
    <param name="image_height" value="480" /> 
    <param name="pixel_format" value="yuyv" /> 
    <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> 

来源

2015-07-11 zumma

A
回答
0

我不知道的警告,但我敢肯定,你已经可以访问摄像机。 关于帧速率,你可以找到它usb_cam /节点/ usb_cam_node.cpp 内的默认帧速率应为30 你可以找到你需要的所有参数:

node_.param("video_device", video_device_name_, std::string("/dev/video0")); 
    node_.param("brightness", brightness_, -1); //0-255, -1 "leave alone" 
    node_.param("contrast", contrast_, -1); //0-255, -1 "leave alone" 
    node_.param("saturation", saturation_, -1); //0-255, -1 "leave alone" 
    node_.param("sharpness", sharpness_, -1); //0-255, -1 "leave alone" 
    // possible values: mmap, read, userptr 
    node_.param("io_method", io_method_name_, std::string("mmap")); 
    node_.param("image_width", image_width_, 640); 
    node_.param("image_height", image_height_, 480); 
    node_.param("framerate", framerate_, 30); 
    // possible values: yuyv, uyvy, mjpeg, yuvmono10, rgb24 
    node_.param("pixel_format", pixel_format_name_, std::string("mjpeg")); 
    // enable/disable autofocus 
    node_.param("autofocus", autofocus_, false); 
    node_.param("focus", focus_, -1); //0-255, -1 "leave alone" 
    // enable/disable autoexposure 
    node_.param("autoexposure", autoexposure_, true); 
    node_.param("exposure", exposure_, 100); 
    node_.param("gain", gain_, -1); //0-100?, -1 "leave alone" 
    // enable/disable auto white balance temperature 
    node_.param("auto_white_balance", auto_white_balance_, true); 
    node_.param("white_balance", white_balance_, 4000); 

    // load the camera info 
    node_.param("camera_frame_id", img_.header.frame_id, std::string("head_camera")); 
    node_.param("camera_name", camera_name_, std::string("head_camera")); 
    node_.param("camera_info_url", camera_info_url_, std::string("")); 

,那么你可能会改变他们在发射文件是这样的:

<param name="autoexposure" value="false" /> 
    <param name="auto_whitebalance" value="false" /> 
    <param name="auto_focus" value="false" /> 
    <param name="auto_brigthness" value="false" /> 
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值