Friday, December 17, 2010

ROS - webcam support

This is for all those opencv fans, who plan to use ROS. ROS believes in a distributed architecture. This is great from a software developer's perspective as feature development can be precisely segmented.

So, how does this model affect poor opencv developers who use unsharable hardware like a webcam. Traditionally, all opencv developers test their image/ video processing codes as separate projects for each feature. This surely helps when you have to split certain complex investigations between diverse teams. Once, investigations prove successful, the gruesome task of integration pops in.

In ROS terms, this would mean separate ROS packages for investigation of each feature. However, during integration running them as separate nodes on the same physical machine would require hardware like webcams to be shared across each node. Attempting to access the webcam through standard opencv functions would be -- "Success" for one node, "Resource busy error" for others.

So, that's where intelligent people @ ROS decided to come up with usbcam driver nodes to publish camera frames using the ROS, so all that each feature node has to do is to subscribe to this driver's topic and each node will be able to get the same camera's feed.

What's the flipside? Different opencv feature nodes cannot modify crucial properties of the camera like capture resolution, framerate,.... There is one driver which is launched with a specific property set and thats it. All nodes have to abide by the set property ( Take what you get ).

There are several such webcam drivers in ROS. Some of them get installed as the camera_drivers stack. Those are mostly the advanced drivers that are mostly used in the PR2. For poor souls like me, who can't afford the PR2 to get live feed, there's the bosch driver packages (just google it) that comes with the usb_cam driver. This allows connectivity with most popular webcams (Anything that works with your google chat, yahoo chat, ....)

In 64 bit ubuntu 10.04 i had some problems compiling the usb_cam drivers. Some minor bugs that can be cleared by just literally doing what the error messages ask you to do. Any issues with the compilation, jst post it in the comments section.

That's it, in the ROS world where everything is distributed... make sure you don't access unsharable hardware without a driver. If none exist, write a simple node that broadcasts minimally processed data from the hardware (that's your driver).

No comments:

Post a Comment