EDU.gatech.cc.is.newton
Class Newton

java.lang.Object
  |
  +--EDU.gatech.cc.is.newton.Newton

public class Newton
extends java.lang.Object

Introduction
Provides an interface to the Newton Research Labs' Cognachrome Vision System. See Newton's Users's Guide for details on their hardware.

Frame of Reference
If (X,Y) is the center of a colored blob in the image, X is the column, numbered from 0 on the left to 200 on the right. Y is the row, from 0 at the top to 255 on the bottom.


Field Summary
static int CHANNEL_A
          One of newton's 3 color channels
static int CHANNEL_B
          One of newton's 3 color channels
static int CHANNEL_C
          One of newton's 3 color channels
static int NEWTON_FAILURE
           
static int NEWTON_IO_FAILURE
           
static int NEWTON_SUCCESS
           
static int NEWTON_UNINITIALIZED
           
 
Constructor Summary
Newton(int serial_port, int baud)
          Instantiate a newton.Newton object.
 
Method Summary
protected  void finalize()
          Dispose of a newton.Newton object.
 void getArea(int channel, int[] values)
          Reports the square root of the area in pixels values of visible blobs on a particular channel.
 int getNumVis(int channel)
          Reports the number of items visible on a certain channel.
 void getX(int channel, int[] values)
          Reports the X values of the visible blobs on a particular channel.
 void getY(int channel, int[] values)
          Reports the Y values of visible blobs on a particular channel.
 void read_frame()
          Reads one frame of visual data from the newton.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHANNEL_A

public static final int CHANNEL_A
One of newton's 3 color channels
See Also:
Newton

CHANNEL_B

public static final int CHANNEL_B
One of newton's 3 color channels
See Also:
Newton

CHANNEL_C

public static final int CHANNEL_C
One of newton's 3 color channels
See Also:
Newton

NEWTON_SUCCESS

public static final int NEWTON_SUCCESS

NEWTON_FAILURE

public static final int NEWTON_FAILURE

NEWTON_IO_FAILURE

public static final int NEWTON_IO_FAILURE

NEWTON_UNINITIALIZED

public static final int NEWTON_UNINITIALIZED
Constructor Detail

Newton

public Newton(int serial_port,
              int baud)
       throws java.lang.Exception
Instantiate a newton.Newton object. You should only instantiate one of these per newton board connected to your computer. Configures the board with default values. Standard call is Newton(3,38400);
Parameters:
serial_port - 1 = ttys0 (COM1), 2 = ttys1 (COM2) ...
baud - (IGNORED FOR NOW!) baud rate for communication.
Throws:
java.lang.Exception - If unable to make native code resident.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Exception,
                        java.lang.Throwable
Dispose of a newton.Newton object. You should never call this, the garbage collector calls it.
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Exception - If unable to release code resources.
java.lang.Throwable - If super.finalize() throws it.

read_frame

public void read_frame()
Reads one frame of visual data from the newton. Use the get* methods to retrieve the data.
See Also:
getNumVis, getX, getY, getArea

getNumVis

public int getNumVis(int channel)
Reports the number of items visible on a certain channel. Use the get* methods to retrieve the data.
Parameters:
channel - the channel to read (e.g. CHANNEL_A).
See Also:
getX, getY, getArea

getX

public void getX(int channel,
                 int[] values)
Reports the X values of the visible blobs on a particular channel. X ranges from 0 to 200 (left to right) Use getNumVis first to size your array. and represents the column of the center of a blob.
Parameters:
channel - the channel to read (e.g. CHANNEL_A).
readings - an array in which to store the X values.
See Also:
getY, getArea

getY

public void getY(int channel,
                 int[] values)
Reports the Y values of visible blobs on a particular channel. Y ranges from 0 to 255 (top to bottom) and represents the row of the center of a blob. Use getNumVis first to size your array.
Parameters:
channel - the channel to read (e.g. CHANNEL_A).
readings - an array in which to store the Y values.
See Also:
getX, getArea, getNumVis

getArea

public void getArea(int channel,
                    int[] values)
Reports the square root of the area in pixels values of visible blobs on a particular channel. Use getNumVis first to size your array.
Parameters:
channel - the channel to read (e.g. CHANNEL_A).
readings - an array in which to store the area values.
See Also:
getX, getY, getNumVis