USB cameras

From RobotinoWiki
Jump to: navigation, search
Model Robotino OS JPG RAW
Logitech HD Webcam C920 v3 yes yes
Logitech Webcam Pro 9000 v2.0 yes yes
Logitech C905 v2.4 yes yes

Using multiple cameras with Robotino v3

Upon delivery Robotino is equipped with a single USB camera. Currently this is a "Logitech HD Webcam C920". The udev rule /etc/udev/rules.d/99-camd2.rules starts Camd2 which grabs images from this camera and makes the stream available over network to Robotino View and the Robotino API2.

In order to use multiple cameras you have to ensure that only the first camera (most likely the camera looking in forward direction) is attached to Camd2.

Use lsusb to see a list of USB devices attached to your Robotino.

#lsusb
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 018: ID 046d:082d Logitech, Inc. 
Bus 001 Device 019: ID 046d:082d Logitech, Inc. 
Bus 001 Device 004: ID 045e:0291 Microsoft Corp. Xbox 360 Wireless Receiver for Windows
Bus 001 Device 005: ID 1e29:040d Festo AG & Co. KG 

In my case I have two Logitech cameras attached. The cameras can be accessed by the /dev/video* devices.

#ls /dev/video*
/dev/video0  /dev/video1

Let us examine /dev/video0

#udevadm info --query=all --attribute-walk --name=/dev/video0 | grep -E "idVendor|serial|idProduct"
ATTRS{idVendor}=="046d"
ATTRS{serial}=="D91198AF"
ATTRS{idProduct}=="082d"
...

#udevadm info --query=all --attribute-walk --name=/dev/video1 | grep -E "idVendor|serial|idProduct"
ATTRS{idVendor}=="046d"
ATTRS{serial}=="25C798AF"
ATTRS{idProduct}=="082d"
...

The first three lines belong to our camera. The following lines belong to USB-hubs and/or USB host controller.

Now we can edit the udev rule to start camd2 with this special camera "D91198AF" and create a symlink for camera "25C798AF"

#nano /etc/udev/rules.d/99-camd2.rules

KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux",ATTRS{idVendor}=="046d", ATTRS{idProduct}=="082d", ATTRS{serial}=="D91198AF", RUN+="/usr/local/robotino/daemons/bin/camd2 -daemon -device=/dev/cam_front -channel=0 -name=default", SYMLINK+="cam_front"

KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux",ATTRS{idVendor}=="046d", ATTRS{idProduct}=="082d", ATTRS{serial}=="25C798AF", SYMLINK+="cam_rear"

After editing /etc/udev/rules.d/99-camd2.rules unplug and replug all cameras.

From within Robotino View you can access the second camera by the symlink "/dev/cam_rear".

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox