Huzeyfe
Huzeyfe

Reputation: 15

ROS Accessing Webcam

I m learning ROS (Beginner) and i m trying to access my webcam

I m trying to use cv_camera module here

http://wiki.ros.org/cv_camera

THis line works fine

rosparam set cv_camera/device_id 0

But i m getting following error on this line

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

Am i supposed to install something or missing something?

Here is my struggle as terminal output (may be helpful)

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$ 

Upvotes: 1

Views: 2722

Answers (2)

Dr Yuan Shenghai
Dr Yuan Shenghai

Reputation: 1915

sudo apt-get install ros-kinetic-uvc-camera
rospack list
rosrun uvc_camera uvc_camera_node
rosrun rqt_image_view rqt_image_view

Try those line. Should help you see the camera stream directly rospack is need if system cant find uvc_camera initially.

Upvotes: 0

Tik0
Tik0

Reputation: 2697

You have to install the cv-camera package. Since you are using ROS kinetic (and presumably Ubuntu 16.04), you have to install it with the following line:

apt-get install ros-kinetic-cv-camera

Here is also a good post about installing packages: LINK. You can also dig into the debug messages of rosrun by using the --debug flag. In my terminal, it tells me then:

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
....

Upvotes: 4

Related Questions