|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--CameraImage
This is the main camera class for the Seeker robot. It is based on the code from the CMUcamGUI
demo program.
It has functionality to dump frames and track colors.
| Field Summary | |
(package private) static char |
a
Tmp variables used for reading and checking for an ACK from the camera. |
(package private) static int |
blue
Used to convert the read data from the camera dump from into a single rgb value. |
(package private) static char |
c
Tmp variables used for reading and checking for an ACK from the camera. |
(package private) static int |
col
Current position of the data being read from a frame dump. |
(package private) static int[][] |
ColorList
List of colors and their color ranges. |
(package private) static java.lang.String |
Command
For preparing a command to send to the camera. |
(package private) static int |
conf
Holders of the data returned from the camera when tracking a color. |
(package private) static int |
data
Hold last read byte from the camera. |
(package private) static int |
Dir
Used for determining the direction we need to move to track the object. |
(package private) static int |
green
Used to convert the read data from the camera dump from into a single rgb value. |
(package private) static char |
k
Tmp variables used for reading and checking for an ACK from the camera. |
(package private) static int |
mmx
Holders of the data returned from the camera when tracking a color. |
(package private) static int |
mmy
Holders of the data returned from the camera when tracking a color. |
(package private) static serialComm |
mySerial
javax.com serial interface class used for talking to the camera. |
(package private) static int |
NumColors
Number of colors the robot can track. |
(package private) static int |
pixColor
Used to convert the read data from the camera dump from into a single rgb value. |
(package private) static int[] |
pixels
Array to hold the data returned from a frame dump. |
(package private) static char |
r
Tmp variables used for reading and checking for an ACK from the camera. |
(package private) static int |
red
Used to convert the read data from the camera dump from into a single rgb value. |
(package private) static int |
row
Current position of the data being read from a frame dump. |
(package private) static int |
start
Flag if we are starting a new command or not. |
(package private) static java.util.Date |
time
Used to check for timeouts reading data. |
(package private) static long |
wdTimer
Used to check for timeouts reading data. |
(package private) static int |
x2coord
Holders of the data returned from the camera when tracking a color. |
(package private) static int |
xcoord
Holders of the data returned from the camera when tracking a color. |
(package private) static int |
XSize
Used for determining the direction we need to move to track the object. |
(package private) static int |
y2coord
Holders of the data returned from the camera when tracking a color. |
(package private) static int |
ycoord
Holders of the data returned from the camera when tracking a color. |
(package private) static int |
zcoord
Holders of the data returned from the camera when tracking a color. |
| Constructor Summary | |
(package private) |
CameraImage(java.lang.String commPort)
Here we simply initialized the variables used by the class. We also initialize the ball color ranges here: (Red Range)(Green Range)(Blue Range) Red = (100 255)(0 50)(0 50) Green = (0 50)(100 255)(0 50) Yellow = (100 255)(100 255)(0 50) White = (150 255)(150 255)(150 255) |
| Method Summary | |
int |
dumpFrame()
Grabs the image column by column and stores it in a 2d array. |
int |
FindColorInImage()
Scan the image looking for one of the colors the robot is searching for. Search algorithm searches from the bottom to the top of the image, and from the center to the outside (left, then right) to find objects that are closer before ones that are further away. |
void |
flushBuf()
Flushes all data out of the serial input buffer |
int |
GetTrackDirection()
Gets the current tracking information from the camera and converts it to tracking information. Reads current tracking information from the camera (which was started by calling trackColor()). Considers object to be centered when x middle mass is between 30 and 60. |
boolean |
idle()
Trys to get the camera to settle down and idle |
boolean |
sendCommand(java.lang.String command)
Sends a command and checks for an ACK |
boolean |
trackColor(int TColor)
This function initializes the camera to start tracking a certain color. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static int[] pixels
static int col
static int row
static int mmx
static int mmy
static int xcoord
static int ycoord
static int zcoord
static int x2coord
static int y2coord
static int conf
static int start
static long wdTimer
static java.util.Date time
static serialComm mySerial
static int pixColor
static int red
static int green
static int blue
static char a
static char c
static char k
static char r
static int data
static int Dir
static int XSize
static int[][] ColorList
static int NumColors
static java.lang.String Command
| Constructor Detail |
CameraImage(java.lang.String commPort)
commPort - Comm port that the camera is attached to| Method Detail |
public boolean trackColor(int TColor)
TColor - Color to track. Possible colors are:
public void flushBuf()
public boolean idle()
public boolean sendCommand(java.lang.String command)
public int dumpFrame()
public int FindColorInImage()
public int GetTrackDirection()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||