Usb cam

From wikidb
Jump to: navigation, search

Indigo

Follow instructions below for Indigo.

Jade

Link

Install Webcam Support

 sudo apt-get install ros-jade-usb-cam
 dpkg -L ros-jade-usb-cam

Note /opt/ros/jade/lib/usb_cam/usb_cam_node.

 sudo apt-get install ros-jade-image-view

Hardware

Test

roscore must be running in another window.

 roscore

Start up a usb_cam publisher and a display subscriber. First create the following launch script. (There is a missing head_camera.yaml problem.)

 cat scripts/usb_cam.launch 
   <launch>
     <node name="usb_cam" pkg="usb_cam" type="usb_cam_node" output="screen" >
       <param name="video_device" value="/dev/video0" />
       <param name="image_width" value="320" />
       <param name="image_height" value="240" />
       <param name="pixel_format" value="mjpeg" />
       <param name="camera_frame_id" value="usb_cam" />
       <param name="io_method" value="mmap"/>
     </node>
     <node name="image_view" pkg="image_view" type="image_view" respawn="false" output="screen">
       <remap from="image" to="/usb_cam/image_raw"/>
     </node>
   </launch>
 
 roslaunch scripts/usb_cam.launch
   ...
   [ INFO] [1439068356.939225858]: using default calibration URL
   [ INFO] [1439068356.939354287]: camera calibration URL: file:///home/eepp/.ros/camera_info/head_camera.yaml
   [ERROR] [1439068356.940529954]: Exception parsing YAML camera calibration:
   yaml-cpp: error at line 0, column 0: bad conversion
   [ERROR] [1439068356.940596498]: Failed to parse camera calibration from file [/home/eepp/.ros/camera_info/head_camera.yaml]
   [ WARN] [1439068356.940648722]: Camera calibration file /home/eepp/.ros/camera_info/head_camera.yaml not found.
   [ INFO] [1439068356.940700246]: Starting 'head_camera' (/dev/video0) at 320x240 via mmap (mjpeg) at 30 FPS
   [ INFO] [1439068356.976897388]: Using transport "raw"
   [ WARN] [1439068357.103766979]: unknown control 'focus_auto'

Usb cam image.png

Calibaration

Failure 1

This is the current set-up.

The date on /opt/ros/jade/lib/camera_calibration/cameracalibrator.py is January 14, 2015

 sudo apt-get install ros-jade-camera-calibration

 rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/image_raw camera:=/camera
   Traceback (most recent call last):
     File "/opt/ros/jade/lib/camera_calibration/cameracalibrator.py", line 49, in <module>
       import cv2
   ImportError: libopencv_core.so.3.0: cannot open shared object file: No such file or directory

Failure 2

Commit to cameracalibrator.py is May 23, 2015. It is different than the one above.

 sudo apt-get remove ros-jade-camera-calibration
 
 git clone https://github.com/ros-perception/image_pipeline.git 
   Cloning into 'image_pipeline'...
   remote: Counting objects: 6345, done.
   remote: Total 6345 (delta 0), reused 0 (delta 0), pack-reused 6345
   Receiving objects: 100% (6345/6345), 17.34 MiB | 1.55 MiB/s, done.
   Resolving deltas: 100% (3865/3865), done.
   Checking connectivity... done.
 
 echo $ROS_PACKAGE_PATH
   /home/eepp/catkin_ws/src:/opt/ros/jade/share:/opt/ros/jade/stacks
 
 cd ../catkin_ws/src/
 
 cp -r ~/ros_packages/image_pipeline/camera_calibration/  .
 
 rosdep install camera_calibration
   #All required rosdeps installed successfully 
 
 rosmake camera_calibration
   [ rosmake ] rosmake starting... 
                                                 
 rosrun camera_calibration cameracalibrator.py --size 8x6 --square 0.108 image:=/camera/image_raw camera:=/camera
   Traceback (most recent call last):
     File "/home/eepp/catkin_ws/src/camera_calibration/nodes/cameracalibrator.py", line 47, in <module>
       import cv2
   ImportError: libopencv_core.so.3.0: cannot open shared object file: No such file or directory


TBD

No accelerated colorspace conversion error

 [swscaler @ 0xa58820] No accelerated colorspace conversion found from yuv422p to rgb24.
 [swscaler @ 0xa58820] No accelerated colorspace conversion found from yuv422p to rgb24.
 [swscaler @ 0xa58820] No accelerated colorspace conversion found from yuv422p to rgb24.
 [swscaler @ 0xa58820] No accelerated colorspace conversion found from yuv422p to rgb24.

Investigate

 rosnode list
   /image_view
   /rosout
   /usb_cam

 rostopic list
   /rosout
   /rosout_agg
   /usb_cam/camera_info
   /usb_cam/image_raw
  
 rqt_graph

Usb cam graph.png

Links