当前位置:   article > 正文

ROS 摄像头使用_ros摄像头

ros摄像头

1、安装rbx1包

创建一个工作空间,这里以catkin_ws 为例,下载并编译rbx1安装包:

$ cd ~/catkin_ws/src 
$ git clone https://github.com/ncnynl/rbx1.git
$ cd ~/catkin_ws
$ catkin_make
  • 1
  • 2
  • 3
  • 4

2、安装usb_cam驱动

$ cd ~/catkin_ws/src  
$ git clone https://github.com/bosch-ros-pkg/usb_cam.git  
$ cd ~/catkin_ws  
$ catkin_make  
  • 1
  • 2
  • 3
  • 4

目前新版本的rbx1已经带有usb_cam,如果没有添加如下。
catkin_ws/src/rbx1/rbx1_vision/launch目录,新建usb_cam.launch

$ cd ~/catkin_ws/src/rbx1/rbx1_vision/launch
$ touch usb_cam.launch
$ vim usb_cam.launch
  • 1
  • 2
  • 3

代码如下:

<launch>
    <arg name="video_device" default="/dev/video0" />

    <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" clear_params="true" output="screen">

        <remap from="usb_cam/image_raw" to="/camera/rgb/image_raw" />
        <remap from="usb_cam/camera_info" to="/camera/rgb/camera_info" />

        <param name="video_device" value="$(arg video_device)" />
        <param name="image_width" value="640" />
        <param name="image_height" value="480" />
        <param name="framerate" value="30" />
        <param name="pixel_format" value="mjpeg" />
        <param name="contrast" value="32" />
        <param name="brightness" value="32" />
        <param name="saturation" value="32" />
        <param name="autofocus" value="true" />
        <param name="camera_frame_id" value="camera_link" />

    </node>
</launch>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

3、测试使用

  • 启动roscore
$ roscore
  • 1
  • 启动rbx1
$ roslaunch rbx1_vision usb_cam.launch video_device:=/dev/video0 
  • 1
  • 查看图像
$ rosrun rqt_image_view rqt_image_view
  • 1

在这里插入图片描述

  • 查看相机相关发布的话题
$ rostopic list
  • 1

显示如下:

/camera/rgb/camera_info
/camera/rgb/image_raw
/camera/rgb/image_raw/compressed
/camera/rgb/image_raw/compressed/parameter_descriptions
/camera/rgb/image_raw/compressed/parameter_updates
/camera/rgb/image_raw/compressedDepth
/camera/rgb/image_raw/compressedDepth/parameter_descriptions
/camera/rgb/image_raw/compressedDepth/parameter_updates
/camera/rgb/image_raw/theora
/camera/rgb/image_raw/theora/parameter_descriptions
/camera/rgb/image_raw/theora/parameter_updates
/rosout
/rosout_agg
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

测试完毕。

小Tips:查看连接的可用设备
在这里插入图片描述

4、参考资料

ROS与深度相机入门教程-在ROS使用webcam摄像头(内置或外置)

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/263084
推荐阅读
相关标签
  

闽ICP备14008679号