Sony PlayStation Eye Webcam
From Tekkotsu Wiki
The Sony Eye webcam device driver for Ubuntu 14.04 uses some different option keywords than the driver for 12.04; see below. The 12.04 driver has problems that are corrected in later kernel versions, so if you're running 12.04 you will need to upgrade to the 3.5.0 kernel. If you are still using Ubuntu 10.04 (no longer supported), you will need to install a custom version of the gspca_ov534 driver. Instructions for doing that are here.
The Calliope2SP robot sets several camera options as part of the Tekkotsu startup routine. For example, since the Sony Eye webcam is mounted upsid-down on the robot, it needs to flip the horizontal and vertical axes of the image. In the 12.04 device driver these options are called HFlip and VFlip, while in the 14.04 they are called Horizontal Flip and Vertical Flip. Two different versions of the options file are provided. The 14.04 version is now the default. To install the older version if you're still running 12.04, do this:
# For Ubuntu 12.04 only cd /usr/local/Tekkotsu/project/defaults sudo cp -p hal-Calliope2SP.plist.ubuntu12 hal-Calliope2SP.plist cd /home/user/project cp -p hal-Calliope2SP.plist.ubuntu12 hal-Calliope2SP.plist
Select Wide Angle View (Blue Dot)
The webcam has an adjustable lens that can be set to either wide angle view (blue dot) or close-up view (red dot). Tekkotsu assumes the wide angle view, so make sure your robot's camera is set to the blue dot.
Querying the Camera Parameters
To see the set of parameters the camera supports and their range of allowable values, type the following in the Tekkotsu console:
The result will look like this under Ubuntu 12.04; some keywords are different in 14.04:
CAMERA DRIVER: Querying Camera Options CAMERA DRIVER: Available Frame Formats: YUYV: Frame size enumeration disabled. CAMERA DRIVER: Available controls (Type 1=Integer 2=Boolean 3=Menu 4=Button): CAMERA DRIVER: Using advanced method of enumerating controls. Brightness: Type: 1, values: [0 - 255], stepsize 1, default 0. Contrast: Type: 1, values: [0 - 255], stepsize 1, default 32. Auto White Balance: Type: 2, values: [0 - 1], stepsize 1, default 1. Exposure: Type: 1, values: [0 - 255], stepsize 1, default 120. Auto Gain: Type: 2, values: [0 - 1], stepsize 1, default 1. Main Gain: Type: 1, values: [0 - 63], stepsize 1, default 20. HFlip: Type: 2, values: [0 - 1], stepsize 1, default 0. VFlip: Type: 2, values: [0 - 1], stepsize 1, default 0. Light Frequency Filter: Type: 3, values: [0 - 1], stepsize 1, default 0. Menu items: index:0 name:Disabled index:1 name:50 Hz Sharpness: Type: 1, values: [0 - 63], stepsize 1, default 0. Auto Exposure: Type: 2, values: [0 - 1], stepsize 1, default 1.
Adjusting the Camera Parameters
To check the quality of color image segmentation, bring up the SegCam viewer in the ControllerGUI.
If color segmentation isn't working well, you may need to manually adjust the camera parameters to correct for the lighting conditions and the type of flooring (e.g., light vs. dark carpet). There are many parameters to choose from, and many possible lighting conditions. To get started, try this:
set Drivers.Camera.Options.Auto Exposure=0 set Drivers.Camera.Options.Auto Gain=0 set Drivers.Camera.Options.Exposure=30 set Drivers.Camera.Options.Contrast=30
The most common reason for bad color segmentation is that the camera gain, exposure time, and brightness are set too high.
You can turn down the gain by typing:
set Drivers.Camera.Options.Auto Gain=0 set Drivers.Camera.Options.Main Gain=15
You can turn down the exposure time by typing:
set Drivers.Camera.Options.Auto Exposure=0 set Drivers.Camera.Options.Exposure=40
You will need to play with the parameter settings until you find values that work best for your actual lighting conditions. Horizontal surfaces (facing the ceiling) can reflect a lot of light from overhead lamps and therefore require different settings for good color segmentation than vertical surfaces (facing the robot).
Some helpful advice on tuning camera parameters for various conditions can be found here.
Saving and Reloading the Camera Parameters
Once the camera parameters are set, you will want to save them so that they can be reloaded whenever you restart Tekkotsu. To save the current settings, type the following in the Tekkotsu console:
You can reload the settings when you next run Tekkotsu by using the -c switch, like this:
./tekkotsu-CALLIOPE2SP -c mysettings.plist