EDU.gatech.cc.is.newton
Class NewtonTrans
java.lang.Object
|
+--EDU.gatech.cc.is.newton.NewtonTrans
- public class NewtonTrans
- extends java.lang.Object
Introduction
Translates objects seen by an newton cognachrome board into
robot-centric coordinates using a linear interpolation method.
It (will soon) catagorizes the blobs for channels A & B according to size.
Frames 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.
In robot coordinates +x is forward, +y is to the left.
A Nomad 150 is .24659467 meters in radius.
File Format
To work properly, NewtonTrans must read a configuration file, passed
to it at construction time. Here is the format:
a_ratio // true blob area = range * a_ratio * pixels_in_blob
num_x // number of X data elements
row x_val // the row of the bottom of the blob and the x coordinate
row x_val // MUST BE IN ASCENDING ROW ORDER !
row x_val
row x_val
row x_val
num_y // number of Y data elements
col y_val // the col of the center of the blob and the y coordinate
col y_val
col y_val
col y_val
col y_val
Here is an example file:
0.00007676243
3
91 2.40559
129 1.31339
235 0.36089
3
95 -0.762
136 0
190 0.762
Constructor Summary |
NewtonTrans(Newton n,
java.lang.String f)
Instantiate a newton.NewtonTrans object. |
Method Summary |
Vec2[] |
getVisualObjects(int chan)
Get an array of Vec2s that point egocentrically from the
turret, or position of the camera to a perceived object. |
static void |
main(java.lang.String[] args)
Test NewtonTrans |
void |
read_frame()
Tell the newton to get a data frame. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
xLut
protected double[] xLut
yLut
protected double[] yLut
a_ratio
protected double a_ratio
newt
protected Newton newt
NO_DATA
public static final double NO_DATA
MAX_BLOBS
public static final int MAX_BLOBS
BIG
public static final double BIG
ALL_MIN
public static final double ALL_MIN
DEBUG
public static final boolean DEBUG
NewtonTrans
public NewtonTrans(Newton n,
java.lang.String f)
- Instantiate a newton.NewtonTrans object.
- Parameters:
n
- the Newton object to get data from.f
- the configuration file name.
read_frame
public void read_frame()
- Tell the newton to get a data frame.
getVisualObjects
public Vec2[] getVisualObjects(int chan)
- Get an array of Vec2s that point egocentrically from the
turret, or position of the camera to a perceived object.
- Parameters:
chan
- the channel (color) of the data to get.- Returns:
- the array of visible objects.
main
public static void main(java.lang.String[] args)
- Test NewtonTrans