OBJECT TRACKING
FIGURE 13.
RT1 represents the Run mode and RT2 jumps to the Test mode.
Before we move further into the program description, we need to look
at the data packet the CMU-01 delivers when we issue a Track Color (TC)
command.
M Packet in Raw Mode
FIGURE 14.
The following is a byte description of the M packet serial data we receive
from the CMU-01. By placing the serial data in an array, we can have the PIC
read the data in the serial array and perform functions depending upon its
value. Interpreting the M-Packet data is key to the program.
The first three bytes equal ACK
FIGURE 15.
FIGURE 16.
ASCII Byte#
A0
C1
K2
CR 3
255 4
M5
MX 6
MY 7
X1 8
Y1 9
X2 10
Y2 11
PIX 12
CONF
:
13
14
The fourth byte equals a Return
Synchronize byte
M packet ID
Middle Mass x value
Middle Mass y value
Leftmost X corner
Leftmost Y corner
Rightmost X corner
Rightmost Y corner
Number of pixels in tracked
region
Confidence Value
Colon (Punctuation Mark)
FIGURE 17.
FIGURE 18.
Both the Test and Run modes read the M packet. Based upon the values
read in the M packet, the robot either moves to track (Run) or reports the
information (Test) on the LCD.
Do You See What I See?
The CMU camera’s view of a target may be different than what you
would expect. The Test mode has been designed to help you select good
target objects and to test their functionality with the C-Bot. In Test mode,
the servomotors are not active. The LCD display provides text information on
what the CMU camera sees and how the robot would move if its servomotors
were active.
Testing a Target
FIGURE 19.
FIGURE 20.
Place the Mode switch to “TEST” on the main circuit board. Choose a
primary color target (like a red ball). Turn on the LCD, CMU-01 camera, and
main circuit board power.
The LCD should display “C-Bot Tracker” upon start-up. Check the LCD
panel; you may need to adjust the contrast to see the text information
(Figure 13).
The next LCD display will say “Blink LED” (Figure 14). The green LED
should blink several times with a time period of 200 milliseconds. This
establishes that the communication link between the PIC and CMU-01 is
working properly.
The next display states “Color & AE on” on LCD line 1 and “Wait 5 sec.”
on LCD line 2 (Figure 15). The CMU-01 camera should be facing a blank wall
to help it adjust for the ambient light.
The next display states “Place Target” on LCD line 1 and “ 5 sec.” on LCD
line 2 (Figure 16). In addition, the green LED will blink 10 times with a period
52 SERVO 05.2009