安装usb_cam ROS 功能包

1、首先看usb_cam: 

直接下载代码: 

进入创建好的工作空间:

cd ~/catkin_ws/src

git clonehttps://github.com/bosch-ros-pkg/usb_cam.git

然后退回到工作空间,编译代码:

cd~/catkin_ws

catkin_make

编译好之后,添加编译好的文件到环境变量:

sourcedevel/setup.bash

然后接下来测试usb_cam: 

先运行usb_cam节点:

rosrun usb_cam usb_cam_node

运行上面命令发现没有显示图像,只看到摄像头打开了。这是因为ros发布的topic是/usb_cam/image_raw。新打开一个终端,可以通过如下命令查看:

rostopic list

结果如下:

/rosout

/rosout_agg

/usb_cam/camera_info/usb_cam/image_raw

/usb_cam/image_raw/compressed

/usb_cam/image_raw/compressed/parameter_descriptions

/usb_cam/image_raw/compressed/parameter_updates

/usb_cam/image_raw/compressedDepth

/usb_cam/image_raw/compressedDepth/parameter_descriptions

/usb_cam/image_raw/compressedDepth/parameter_updates

/usb_cam/image_raw/theora

/usb_cam/image_raw/theora/parameter_descriptions

/usb_cam/image_raw/theora/parameter_updates

所以我们需要运行如下命令才可以看到图像:

rosrun image_view image_view image:=/usb_cam/image_raw

或者直接写launch文件,这样就不用一个终端运行node,一个终端看图像。新建usb_cam_test.launch:

   

     

     

     

     

     

     

   

   

     

     

   

 

其中字段的意义可按照字面理解,这里不再解释。 

然后终端直接运行:

roslaunch usb_cam usb_cam_test.launch

你可能感兴趣的:(安装usb_cam ROS 功能包)