View Single Post
  #12   Spotlight this post!  
Unread 17-01-2006, 23:20
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Camera pointing error?

Quote:
Originally Posted by Terry Sherman
Fairly certain, the datasheet for the CMUcam2 module states the max resulution is: 160x255. Granted the OV7620 is 640x480 the CMUcam2 is the limiting factor. Through experimentation we've concluded the resolution based on the vertical mounting we have, is
0-239 x-axis, 'pan'
0-159 y-axis, 'tilt'
(By veritcal mounting I mean we are using the camera mounting hardware included in the kit and the overall leangth of the CMUcam2 module is going up and down).

Looking at the OV7620 datasheet we may be off a little bit, instead of 240 it may be 255 but we haven't checked over all the CMUcam2's registers that might relate to resolution.

-Terry
Well, I don't know why you think the code is wrong, but all the information I have indicates that the code is correct. Have a look at the portion of the CMUcam2 FAQ that Mark was nice enough to post. Notice that the resolution for the OV7620 camera module is stated as 160x239, not 239x160. While testing an early version of the code, I noticed that the error could grow to different numbers before losing lock depending on the direction the camera was panning. Well, I had assumed that the resolution was 239x160 too, but found that I was wrong after doing a little investigating. You can do the same experiment: Let the camera acquire the target and then unplug the servos. Now manually pan the camera until it can't see the green target and notice the error in number of pixels. For me, the maximum error before loosing lock is 80 pixels, which implies the image is 160 pixels wide. Just as a sanity check, I dug out my copy of the actual code that executes on the CMUcam2 and found this code:

Code:
void setDefaultWindow()

{
unsigned int16 size;
unsigned int8 size_lo @ size;
unsigned int8 size_hi @ size+1;
unsigned int16 img_height;
unsigned int8 img_height_lo @ img_height;
unsigned int8 img_height_hi @ img_height+1;
 
xBox=1;
yBox=1;
if(camera_type) {// Using 7620
img_height=239; // 240;
AREG=160; // 160;
}
else{// Using 6620
img_height=143;
AREG=88;
if(hiresCameraMode) {
img_height=287;
AREG=176;
}
}
 
// the code here should really add (sample_factor-1)
// before the division, but there is no rom space to do it.

img_width = AREG;

I know it's fun to play the let's-publicly-flog-the-NASA-rocket-scientist-when-he-makes-a-mistake game, but keep in mind that spreading half-baked information around, at the very least, just adds to the noise level of the forums. Frankly, I would have preferred that you'd sent me a PM or e-mail to inform me of your suspicions. If you had, I would have given you the above information.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org