ROS 访问网络摄像头

ROS Accessing Webcam

我正在学习 ROS(初学者)并且我正在尝试访问我的网络摄像头

我想在这里使用 cv_camera 模块

http://wiki.ros.org/cv_camera

这条线工作正常

rosparam set cv_camera/device_id 0

但是我在这条线上收到以下错误

rosrun cv_camera cv_camera_node
[rospack] Error: package 'cv_camera' not found

我应该安装一些东西还是缺少一些东西?

这是我作为终端输出的挣扎(可能会有帮助)

huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ source devel/setup.bash
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ source /opt/ros/kinetic/setup.bash
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rosparam set cv_camera/device_id 1
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rosrun cv_camera cv_camera_node
[rospack] Error: package 'cv_camera' not found
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ echo $ROS_PACKAGE_PATH
/opt/ros/kinetic/share
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ source devel/setup.bash
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ echo $ROS_PACKAGE_PATH
/home/huzeyfe/catkin_ws/src:/opt/ros/kinetic/share
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rosrun cv_camera cv_camera_node
[rospack] Error: package 'cv_camera' not found
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rosparam set cv_camera/device_id 1
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rosrun cv_camera cv_camera_node
[rospack] Error: package 'cv_camera' not found
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rospack profile
Full tree crawl took 0.018304 seconds.
Directories marked with (*) contain no manifest.  You may
want to delete these directories.
To get just of list of directories without manifests,
re-run the profile with --zombie-only
-------------------------------------------------------------
0.016891   /opt/ros/kinetic/share
0.000488 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev
0.000077 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev/haarcascades
0.000056 * /opt/ros/kinetic/share/OpenCV-3.3.1-dev/lbpcascades
0.000042 * /home/huzeyfe/catkin_ws/src
0.000038 * /opt/ros/kinetic/share/doc
0.000007 * /opt/ros/kinetic/share/doc/liborocos-kdl
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ rosrun cv_camera cv_camera_node
[rospack] Error: package 'cv_camera' not found
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ echo $ROS_PACKAGE_PATH
/home/huzeyfe/catkin_ws/src:/opt/ros/kinetic/share
huzeyfe@huzeyfe-Aspire-5755G:~/catkin_ws$ 

您必须安装 cv-camera 软件包。由于您使用的是 ROS kinetic(并且可能是 Ubuntu 16.04),因此您必须使用以下行安装它:

apt-get install ros-kinetic-cv-camera

这里还有一个关于安装包的好post:LINK。 您还可以使用 --debug 标志深入了解 rosrun 的调试消息。在我的终端里,它告诉我:

bash> rosrun --debug cv_camera cv_camera_node
[rosrun] Looking in catkin libexec dirs: /opt/ros/kinetic/lib/cv_camera
[rosrun] Looking in rospack dir: /opt/ros/kinetic/share/cv_camera
[rosrun]   2
[rosrun] Searching for cv_camera_node with permissions /111
[rosrun]   2
[rosrun] Running  /opt/ros/kinetic/lib/cv_camera/cv_camera_node
....
sudo apt-get install ros-kinetic-uvc-camera
rospack list
rosrun uvc_camera uvc_camera_node
rosrun rqt_image_view rqt_image_view

试试那些线。应该可以帮助您直接看到相机流 如果系统最初找不到 uvc_camera,则需要 rospack。