edu.wpi.first.wpilibj.camera
Class AxisCamera

java.lang.Object
  extended by edu.wpi.first.wpilibj.camera.AxisCamera
All Implemented Interfaces:
IDevice, ISensor

public class AxisCamera
extends java.lang.Object
implements ISensor

This class is a singleton used to configure and get images from the axis camera.

Author:
dtjones

Nested Class Summary
static class AxisCamera.ExposurePriorityT
          Enumeration representing the exposure priority.
static class AxisCamera.ExposureT
          Enumaration representing the different values which exposure may be set to.
static class AxisCamera.ResolutionT
          Enumeration representing the image resoultion provided by the camera.
static class AxisCamera.RotationT
          Enumeration representing the orientation of the picture.
static class AxisCamera.WhiteBalanceT
          Enumeration representing the different values which white balence may be set to.
 
Method Summary
 boolean freshImage()
          Has the current image from the camera been retrieved yet.
 int getBrightness()
          Get the current brightness of the AxisCamera
 int getColorLevel()
          Get the color level of images being retunred from the camera.
 int getCompression()
          Get the compression of the images eing returned by the camera.
 AxisCamera.ExposureT getExposureControl()
          Get the exposure mode that the camera is using.
 AxisCamera.ExposurePriorityT getExposurePriority()
          Get the exposure priority that the camera is using.
 ColorImage getImage()
          Get an image from the camera.
static AxisCamera getInstance()
          Get a reference to the AxisCamera, or initialize the AxisCamera if it has not yet been initialized.
static AxisCamera getInstance(java.lang.String address)
          Get a reference to the AxisCamera, or initialize the AxisCamera if it has not yet been initialized.
 int getMaxFPS()
          Get the maximum frames per second that the camera will generate.
 AxisCamera.ResolutionT getResolution()
          Get the resolution fo the images that the camera is returning.
 AxisCamera.RotationT getRotation()
          Get the rotation of the images returned from the camera.
 AxisCamera.WhiteBalanceT getWhiteBalance()
          Get the white balance set on the camera.
 void writeBrightness(int brightness)
          Write the brightness for the camera to use.
 void writeColorLevel(int value)
          Set the color level of images returned from the camera.
 void writeCompression(int value)
          Write the level of JPEG compression to use on images returned from the camera.
 void writeExposureControl(AxisCamera.ExposureT value)
          Write the exposure mode for the camera to use.
 void writeExposurePriority(AxisCamera.ExposurePriorityT value)
          Write the exposure priority for the camera to use.
 void writeMaxFPS(int value)
          Set the maximum frames per second that the camera will generate.
 void writeResolution(AxisCamera.ResolutionT value)
          Set the resolution of the images to return.
 void writeRotation(AxisCamera.RotationT value)
          Write the rotation of images for the camera to return.
 void writeWhiteBalance(AxisCamera.WhiteBalanceT whiteBalance)
          Write the WhiteBalance for the camera to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static AxisCamera getInstance(java.lang.String address)
Get a reference to the AxisCamera, or initialize the AxisCamera if it has not yet been initialized. If the camera is connected to the Ethernet switch on the robot, then this address should be 10.x.y.11 where x.y are your team number subnet address (same as the other IP addresses on the robot network).

Parameters:
address - A string containing the IP address for the camera in the form "10.x.y.2" for cameras on the Ethernet switch or "192.168.0.90" for cameras connected to the 2nd Ethernet port on an 8-slot cRIO.
Returns:
A reference to the AxisCamera.

getInstance

public static AxisCamera getInstance()
Get a reference to the AxisCamera, or initialize the AxisCamera if it has not yet been initialized. By default this will connect to a camera with an IP address of 10.x.y.11 with the preference that the camera be connected to the Ethernet switch on the robot rather than port 2 of the 8-slot cRIO.

Returns:
A reference to the AxisCamera.

getImage

public ColorImage getImage()
                    throws AxisCameraException,
                           NIVisionException
Get an image from the camera. Be sure to free the image when you are done with it.

Returns:
A new image from the camera.
Throws:
AxisCameraException
NIVisionException

writeBrightness

public void writeBrightness(int brightness)
Write the brightness for the camera to use.

Parameters:
brightness - This must be an integer between 0 and 100, with 100 being the brightest

getBrightness

public int getBrightness()
Get the current brightness of the AxisCamera

Returns:
An integer representing the current brightness of the axis camera with 0 being the darkest and 100 being the brightest.

writeWhiteBalance

public void writeWhiteBalance(AxisCamera.WhiteBalanceT whiteBalance)
Write the WhiteBalance for the camera to use.

Parameters:
whiteBalance - The value to set the white balance to on the camera.

getWhiteBalance

public AxisCamera.WhiteBalanceT getWhiteBalance()
Get the white balance set on the camera.

Returns:
The white balance currently set on the camera.

writeColorLevel

public void writeColorLevel(int value)
Set the color level of images returned from the camera.

Parameters:
value - This must be an integer from 0 to 100 with 0 being black and white.

getColorLevel

public int getColorLevel()
Get the color level of images being retunred from the camera.

Returns:
The color level of images being returned from the camera. 0 is black and white.

writeExposureControl

public void writeExposureControl(AxisCamera.ExposureT value)
Write the exposure mode for the camera to use.

Parameters:
value - The expsure mode for the camera to use.

getExposureControl

public AxisCamera.ExposureT getExposureControl()
Get the exposure mode that the camera is using.

Returns:
The exposure mode that the camera is using.

writeExposurePriority

public void writeExposurePriority(AxisCamera.ExposurePriorityT value)
Write the exposure priority for the camera to use.

Parameters:
value - The exposure priority to use.

getExposurePriority

public AxisCamera.ExposurePriorityT getExposurePriority()
Get the exposure priority that the camera is using.

Returns:
The exposure priority that the camera is using

writeResolution

public void writeResolution(AxisCamera.ResolutionT value)
Set the resolution of the images to return.

Parameters:
value - The resolution imaga for the camera to return.

getResolution

public AxisCamera.ResolutionT getResolution()
Get the resolution fo the images that the camera is returning.

Returns:
The resolution of the images that the camera is returning.

writeCompression

public void writeCompression(int value)
Write the level of JPEG compression to use on images returned from the camera.

Parameters:
value - The level of JPEG compression to use from 0 to 100 with 0 being the least compression.

getCompression

public int getCompression()
Get the compression of the images eing returned by the camera.

Returns:
The level of compression of the image being returned from the camera with 0 being the least and 100 being the greatest.

writeRotation

public void writeRotation(AxisCamera.RotationT value)
Write the rotation of images for the camera to return.

Parameters:
value - The rotation to be applied to images from the camera.

getRotation

public AxisCamera.RotationT getRotation()
Get the rotation of the images returned from the camera.

Returns:
The rotation of the images returned from the camera.

freshImage

public boolean freshImage()
Has the current image from the camera been retrieved yet.

Returns:
true if the latest image from the camera has not been retrieved yet.

getMaxFPS

public int getMaxFPS()
Get the maximum frames per second that the camera will generate.

Returns:
the max fps.

writeMaxFPS

public void writeMaxFPS(int value)
Set the maximum frames per second that the camera will generate.

Parameters:
value - the new max fps