STEP1安装usb_cam
创建一个工作空间,make一下
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
STEP2下面是安装usb_cam
cd catkin_ws/src
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 如果出现错误转到下一个步骤的解决方法)
出现错误:
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 image_view image_view image:=/usb_cam/image_raw
原文地址:https://www.cnblogs.com/1228073191Blog/p/10606628.html