Ubuntu14.04+ROS 启动本地摄像头

STEP1安装usb_cam

创建一个工作空间,make一下

mkdir  -p ~/catkin_ws/src

cd ~/catkin_ws/

catkin_make

 

STEP2下面是安装usb_cam

cd catkin_wssrc

git clone https://github.com/bosch-ros-pkg/usb_cam usb_cam

cd usb_cam

mkdir build

cd build

cmake ..

make

到这个步骤已经安装好usb_cam了,下面可以测试下是否安装成功。

打开一个新的terminal

 

roscore

 

重新打开一个新的terminal进入~/catkin_ws/src/usb_cam/launch输入下面指令打开摄像头

roslaunch usb_cam-test.launch 

或者使用(推荐使用本方法) roslaunch usb_cam usb_cam-test.launch  如果出现错误,则使用如下方法。

zc@ubuntu:~/catkin_ws $ source devel/setup.bash
zc@ubuntu:~/catkin_ws $ roslaunch usb_cam usb_cam-test.launch

如图:

应该就可以直接启动了,下面的步骤也就不需要了。

 

出现错误:

ERROR: cannot launch node of type [usb_cam/usb_cam_node]: usb_cam

ROS path [0]=/opt/ros/indigo/share/ros

ROS path [1]=/opt/ros/indigo/share

ROS path [2]=/opt/ros/indigo/stacks

 

 

 

 

 

 

新开一个终端运行:

zc@ubuntu:~/catkin_ws $

rosrun usb_cam usb_cam_node

 

如果出现错误:

 

 

那么运行:

zc@ubuntu:~/catkin_ws $

source devel/setup.bash

然后再运行rosrun usb_cam usb_cam_node

 

然后要显示图像的话,运行:

rosrun image_view image_view image:=/usb_cam/image_raw

 

 

posted on 2019-03-27 12:06  czhang4  阅读(2489)  评论(0编辑  收藏  举报