USB camera (UVC) driver API review

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

USB camera (UVC) driver API review

Ken Tossell
As part of the drivers SIG's effort to establish officially supported driver packages for USB cameras, I'm proposing a new USB Video Class (UVC) driver.


libuvc_camera uses a libusb-based userspace UVC library to stream video frames from UVC devices and to read, set and monitor control settings. It is intended to be cross-platform (Mac, potentially Windows) and to enable ROS driver features that are not available through Video4Linux. Examples include more accurate timestamps; lower, more predictable latency; and efficient monitoring of camera-controlled parameters (e.g., exposure time).

I've created an API review page:


If you are interested in this driver, please take a look at the ROS API and share your comments on the review page.

_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users
Reply | Threaded
Open this post in threaded view
|

Re: USB camera (UVC) driver API review

Kevin Walchko
Hi,

Here is a patch for the rosdep.yaml for OSX for lib-usb.


I tried to compile this on my Mac and it failed complaining:  ld: library not found for -lrosthread. I haven't heard of that library before.

-- snippet ---

[rosmake-0] Finished <<< test_rosmake [PASS] [ 1.44 seconds ]                   
[rosmake-0] Starting >>> test_roscpp [ make ]                                   
[rosmake-0] Finished <<< test_roscpp [PASS] [ 12.43 seconds ]                   
[rosmake-0] Starting >>> test_crosspackage [ make ]                             
[rosmake-0] Finished <<< test_crosspackage [PASS] [ 2.53 seconds ]              
[rosmake-0] Starting >>> test_rosservice [ make ]                               
[rosmake-0] Finished <<< test_rosservice [PASS] [ 2.26 seconds ]                
[rosmake-0] Starting >>> test_topic_tools [ make ]                              
[ rosmake ] Last 40 linesbuvc_camera: 24.7 sec ] ... [ 2 Active 69/93 Complete ]
{-------------------------------------------------------------------------------
  [rosbuild] Cached build flags older than manifests; calling rospack to get flags
  [rosbuild] Including /usr/local/electric/ros_comm/clients/roslisp/cmake/roslisp.cmake
  [rosbuild] Including /usr/local/electric/ros_comm/clients/rospy/cmake/rospy.cmake
  [rosbuild] Including /usr/local/electric/ros_comm/clients/cpp/roscpp/cmake/roscpp.cmake
  MSG: gencfg_cpp on:UVCCamera.cfg
  Finding dependencies for /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/cfg/UVCCamera.cfg
  -- Configuring done
  -- Generating done
  CMake Warning:
    Manually-specified variables were not used by the project:
  
      CMAKE_TOOLCHAIN_FILE
  
  
  -- Build files have been written to: /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/build
  cd build && make -l2
  Scanning dependencies of target ROSBUILD_gencfg_cpp
  [ 20%] Generating ../cfg/cpp/libuvc_camera/UVCCameraConfig.h, ../docs/UVCCameraConfig.dox, ../docs/UVCCameraConfig-usage.dox, ../src/libuvc_camera/cfg/UVCCameraConfig.py, ../docs/UVCCameraConfig.wikidoc
  Generating reconfiguration files for UVCCamera in libuvc_camera
  [ 20%] Built target ROSBUILD_gencfg_cpp
  Scanning dependencies of target rospack_gencfg
  [ 20%] Built target rospack_gencfg
  Scanning dependencies of target rospack_genmsg_libexe
  [ 20%] Built target rospack_genmsg_libexe
  Scanning dependencies of target rosbuild_precompile
  [ 20%] Built target rosbuild_precompile
  Scanning dependencies of target camera_node
  [ 40%] Building CXX object CMakeFiles/camera_node.dir/src/main.o
  [ 60%] Building CXX object CMakeFiles/camera_node.dir/src/camera_driver.o
  /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/src/camera_driver.cpp: In member function ‘void libuvc_camera::CameraDriver::AutoControlsCallback(uvc_status_class, int, int, uvc_status_attribute, void*, size_t)’:
  /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/src/camera_driver.cpp:162: warning: format ‘%u’ expects type ‘unsigned int’, but argument 6 has type ‘size_t’
  /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/src/camera_driver.cpp:162: warning: format ‘%u’ expects type ‘unsigned int’, but argument 6 has type ‘size_t’
  /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/src/camera_driver.cpp:165: warning: enumeration value ‘UVC_STATUS_CLASS_CONTROL’ not handled in switch
  Linking CXX executable ../bin/camera_node
  ld: library not found for -lrosthread
  collect2: ld returned 1 exit status
  make[3]: *** [../bin/camera_node] Error 1
  make[2]: *** [CMakeFiles/camera_node.dir/all] Error 2
  make[1]: *** [all] Error 2
-------------------------------------------------------------------------------}
[ rosmake ] Output from build of package libuvc_camera written to:
[ rosmake ]    /Users/kevin/.ros/rosmake/rosmake_output-20120218-092742/libuvc_camera/build_output.log
[rosmake-1] Finished <<< libuvc_camera [FAIL] [ 24.76 seconds ]                 
[ rosmake ] Halting due to failure in package libuvc_camera. 
[ rosmake ] Waiting for other threads to complete.
[rosmake-0] Finished <<< test_topic_tools [PASS] [ 2.54 seconds ]               
[ rosmake ] Results:                                                            
[ rosmake ] Built 71 packages with 1 failures.                                  
[ rosmake ] Summary output to directory                                         
[ rosmake ] /Users/kevin/.ros/rosmake/rosmake_output-20120218-092742            
[ rosmake ] WARNING: Rosdep did not detect the following system dependencies as installed: libusb-1.0 Consider using --rosdep-install option or `rosdep install libuvc_camera libuvc`




On Feb 17, 2012, at 1:44 PM, Ken Tossell wrote:

As part of the drivers SIG's effort to establish officially supported driver packages for USB cameras, I'm proposing a new USB Video Class (UVC) driver.


libuvc_camera uses a libusb-based userspace UVC library to stream video frames from UVC devices and to read, set and monitor control settings. It is intended to be cross-platform (Mac, potentially Windows) and to enable ROS driver features that are not available through Video4Linux. Examples include more accurate timestamps; lower, more predictable latency; and efficient monitoring of camera-controlled parameters (e.g., exposure time).

I've created an API review page:


If you are interested in this driver, please take a look at the ROS API and share your comments on the review page.
_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users


_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users

osx_rosdep.patch (243 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: USB camera (UVC) driver API review

Ken Tossell-2
On Sat, Feb 18, 2012 at 9:48 AM, Kevin Walchko <[hidden email]> wrote:
Here is a patch for the rosdep.yaml for OSX for lib-usb.

Applied, thanks! 

I tried to compile this on my Mac and it failed complaining:  ld: library not found for -lrosthread. I haven't heard of that library before.

I've taken -lrosthread out of libuvc's manifest.xml. I'm assuming it was removed recently, like -lros was removed in Fuerte, though both of those flags are still suggested on <http://ros.org/wiki/Manifest#Example> and <http://www.ros.org/doc/api/rospkg/html/manifest_xml.html#export-cpp>. Anyway, libuvc didn't need to use any ROS libraries.

 - Ken

_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users
Reply | Threaded
Open this post in threaded view
|

Re: USB camera (UVC) driver API review

Kevin Walchko
Ken,

I finally got it to work!



It still didn't work for me at first … there was a library issue and I added a couple lines to your make file to fix it. Error shown below:

[kevin@TARDIS libuvc_camera]$ rosrun libuvc_camera camera_node 
dyld: Library not loaded: libuvc.dylib
  Referenced from: /Users/kevin/ros_sandbox/libuvc_ros/libuvc_camera/bin/camera_node
  Reason: image not found
Trace/BPT trap: 5

Once the library issue was fixed I still can't run it. Not sure what I am supposed to do? It doesn't find the camera on my macbook pro, am I supposed to pass camera_node something? Maybe my built in camera is not a UVC camera??? I tried giving it vendor and product id, but that didn't help.

[kevin@TARDIS libuvc_camera]$ rosrun libuvc_camera camera_node
[ INFO] [1329608705.284208000]: using default calibration URL
[ INFO] [1329608705.285405000]: camera calibration URL: file:///Users/kevin/.ros/camera_info/camera.yaml
[ERROR] [1329608705.285662000]: Unable to open camera calibration file [/Users/kevin/.ros/camera_info/camera.yaml]
[ WARN] [1329608705.285929000]: Camera calibration file /Users/kevin/.ros/camera_info/camera.yaml not found.
[ INFO] [1329608705.332974000]: Opening camera with vendor=0x0, product=0x0, serial="", index=0
uvc_open: Unknown error (-99)

I tried a Logitech c270 which is uvc and it gave me the same answer except for the error changed to:

uvc: device has a status interrupt endpoint, but unable to read from it
uvc_open: Unknown error (-99)

However, once I told it vendor and product code for the Logitech camera, it worked!!

rosrun libuvc_camera camera_node _vendor:="0x046 _product:="0x0825" 


On Feb 18, 2012, at 3:47 PM, Ken Tossell wrote:

On Sat, Feb 18, 2012 at 9:48 AM, Kevin Walchko <[hidden email]> wrote:
Here is a patch for the rosdep.yaml for OSX for lib-usb.

Applied, thanks! 

I tried to compile this on my Mac and it failed complaining:  ld: library not found for -lrosthread. I haven't heard of that library before.

I've taken -lrosthread out of libuvc's manifest.xml. I'm assuming it was removed recently, like -lros was removed in Fuerte, though both of those flags are still suggested on <http://ros.org/wiki/Manifest#Example> and <http://www.ros.org/doc/api/rospkg/html/manifest_xml.html#export-cpp>. Anyway, libuvc didn't need to use any ROS libraries.

 - Ken
_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users


_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users

libuvc_osx.patch (529 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: USB camera (UVC) driver API review

Ken Tossell-2
Hi Kevin,

I had a problem where libusb was unable to submit the isochronous
transfer request for video streaming: libusb_submit_transfer would
return -99, which was the result of a kIOUSBNotSent1Err error in the
OSX libusb module. libusb was updated to work around that issue in
2010, but there hasn't been a release since then; the version in
<git://git.libusb.org/libusb.git> might do better.

I think this is relevant:
<http://comments.gmane.org/gmane.comp.lib.libusb.devel.general/10637>.
The "unable to read from it" might be related, although that's an
error with an interrupt transfer, not an isochronous transfer.

I don't think I ever got an internal camera to work on a Mac; I
believe the OS was claiming it, and libusb wasn't able to take it
over, even after I moved a few .kext files out of the way. The cameras
do work with libuvc under Linux; the ones I tried were definitely
almost-correct UVC.

 - Ken
_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users
Reply | Threaded
Open this post in threaded view
|

Re: USB camera (UVC) driver API review

Dejan Pangercic
In reply to this post by Ken Tossell
Hi Ken,
we have extracted passive auto focus out of the guvcview driver and
patched your uvc_camera driver with it. We could provide that same for
the libuvc_camera as well.

D.

On Fri, Feb 17, 2012 at 7:44 PM, Ken Tossell <[hidden email]> wrote:

> As part of the drivers SIG's effort to establish officially supported driver
> packages for USB cameras, I'm proposing a new USB Video Class (UVC) driver.
>
> http://www.ros.org/wiki/libuvc_camera
>
> libuvc_camera uses a libusb-based userspace UVC library to stream video
> frames from UVC devices and to read, set and monitor control settings. It is
> intended to be cross-platform (Mac, potentially Windows) and to enable ROS
> driver features that are not available through Video4Linux. Examples include
> more accurate timestamps; lower, more predictable latency; and efficient
> monitoring of camera-controlled parameters (e.g., exposure time).
>
> I've created an API review page:
>
> http://www.ros.org/wiki/libuvc_camera/Reviews/2012-02-23_API_Review
>
> If you are interested in this driver, please take a look at the ROS API and
> share your comments on the review page.
>
> _______________________________________________
> ros-users mailing list
> [hidden email]
> https://code.ros.org/mailman/listinfo/ros-users
>



--
Dipl.-Ing. Dejan Pangercic
PhD Student/Researcher
Intelligent Autonomous Systems Group
Technische Universität München
Telephone: +49 (89) 289-26908
E-Mail: [hidden email]
WWW: http://ias.cs.tum.edu/people/pangercic
_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users
Reply | Threaded
Open this post in threaded view
|

Re: USB camera (UVC) driver API review

Ken Tossell-2
On Sun, Feb 19, 2012 at 6:28 PM, Dejan Pangercic
<[hidden email]> wrote:
> Hi Ken,
> we have extracted passive auto focus out of the guvcview driver and
> patched your uvc_camera driver with it. We could provide that same for
> the libuvc_camera as well.

That would be a really nice feature, but unfortunately we can't
include the guvcview code in this package, as guvcview is provided
under the GPL and libuvc_camera needs to have a license that would let
a user link the driver into non-GPL software (mainly nodelets).

Unless someone wants to rewrite the autofocus code or you can get
permission to re-license guvcview's implementation: Could this be used
as a separate node?

For the rewriting option: Do you know of any document that describes
the auto-focus algorithm found in gucview? I've read the source, and I
think I understand most of it, but there are a few places in
getFocusVal() where I'm getting lost.

 - Ken
_______________________________________________
ros-users mailing list
[hidden email]
https://code.ros.org/mailman/listinfo/ros-users