Go to Post Titanium is almost twice as heavy as aluminum. I can have the bragging aspect of making a bullet resistant robot, but if someone is coming into a competition and shooting my robot, I have more important things to worry about! - Andrew Blair [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-01-2006, 18:59
Craig Putnam Craig Putnam is offline
Registered User
#0042 (P.A.R.T.S.)
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 1997
Location: Hudson, NH
Posts: 16
Craig Putnam is on a distinguished road
Question Camera pointing error?

We have the camera calibrated and tracking the lightbox target using the tilt/pan mechanism. However . . . when the camera is nicely locked onto the target, it consistently points a little to the left of the target (and a little high too). This is based on an admittedly unscientific estimate of where the camera is 'boresighted'; I simply looked at the tilt/pan mechanism and where the camera appears to be aimed. It's not off by a lot, but it is most definitely off.

Being bothered by this, we ran a little experiment. We left the camera pointing exactly where it locked onto the target using the Bells & Whistles tracking code, then switched it over to the LabView GUI. When we look at the picture using that GUI, the target is dead center in the image. So it appears that the code is doing exactly what it is supposed to do.

We can certainly use the camera this way, but it is very off-putting to have it lock on nice and solidly and be pointing nearly 10 degrees to the left and up (my estimate based on the geometry of the test rig we have set up).

I did another little experiment and pulled up one side of the header used to connect the camera to the motherboard - so the camera is now a little cockeyed relative to the plane of the motherboard. As I expected, that corrected the panning problem, but it's not of course a satisfactory solution.

It acts like an alignment error in the camera unit itself, but I think that's pretty unlikely...

Has anyone else experienced this, have any ideas about what is going on or how to correct it?

Thanks in advance for your advice and wisdom.
  #2   Spotlight this post!  
Unread 15-01-2006, 20:27
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Camera pointing error?

Quote:
Originally Posted by Craig Putnam
We have the camera calibrated and tracking the lightbox target using the tilt/pan mechanism. However . . . when the camera is nicely locked onto the target, it consistently points a little to the left of the target (and a little high too). This is based on an admittedly unscientific estimate of where the camera is 'boresighted'; I simply looked at the tilt/pan mechanism and where the camera appears to be aimed. It's not off by a lot, but it is most definitely off.

Being bothered by this, we ran a little experiment. We left the camera pointing exactly where it locked onto the target using the Bells & Whistles tracking code, then switched it over to the LabView GUI. When we look at the picture using that GUI, the target is dead center in the image. So it appears that the code is doing exactly what it is supposed to do.

We can certainly use the camera this way, but it is very off-putting to have it lock on nice and solidly and be pointing nearly 10 degrees to the left and up (my estimate based on the geometry of the test rig we have set up).

I did another little experiment and pulled up one side of the header used to connect the camera to the motherboard - so the camera is now a little cockeyed relative to the plane of the motherboard. As I expected, that corrected the panning problem, but it's not of course a satisfactory solution.

It acts like an alignment error in the camera unit itself, but I think that's pretty unlikely...

Has anyone else experienced this, have any ideas about what is going on or how to correct it?

Thanks in advance for your advice and wisdom.
It sounds like something that will be constant if all of your results are correct. If I were you, I'd add a constant offset into my code to compensate for the error.

Good luck,
-Joe
  #3   Spotlight this post!  
Unread 15-01-2006, 20:52
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,019
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Camera pointing error?

Quote:
Originally Posted by Craig Putnam
<snip>Has anyone else experienced this, have any ideas about what is going on or how to correct it?
From your description, the problem is one of cosmetics - the camera is tracking perfectly, but it "looks" like it is off by 10 degrees.

My advice would be to ignore it, there's nothing to correct since there's nothing "wrong".

(OTOH, it's probably something in the camera optics - where it is mechanically pointed is not identical to where it is optically pointed. It is likely that all cameras are the same)

Don
__________________

I am N2IRZ - What's your callsign?
  #4   Spotlight this post!  
Unread 15-01-2006, 22:02
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 Craig Putnam
Has anyone else experienced this, have any ideas about what is going on or how to correct it?
There is bound to be some error between where the camera appears to be pointing and where the centroid pixel is located on the imager. Many factors contribute to this error including optical distortion and misalignment of the imager relative to the centerline of the lens.

There is a fairly easy way to deal with this error and it's built into the camera software. Mount the FIRST green light such that it's center is at the same height as the camera lens and position your 'bot so that the center line of the lens extends through the center of the FIRST green light. Do this as far away from the green light as you can. Now fire up the robot controller and camera and let the camera lock onto the green light. Once it's locked on to the target, enter the tracking menu and then the interactive PWM sub-menu and type in the letter 'f' to set the new pan center position and then the letter 'm' to set the new tilt center position. Now type in the letter 'o' and write down the pan and tilt values. Once you've done that, type in 'p' to return to the main tracking menu and then 'w' to save the changes. Take the values you wrote down and plug them into the equation in terminal.c and recompile, reload the code and see if the software reports zero degrees for the pan and tilt angles when the camera re-acquires the target.

I intend to release one or two more builds of the camera software in the coming weeks and I'll try to include this procedure in the documentation. I think I'll start a camera FAQ and include this information as well.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #5   Spotlight this post!  
Unread 15-01-2006, 22:13
Craig Putnam Craig Putnam is offline
Registered User
#0042 (P.A.R.T.S.)
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 1997
Location: Hudson, NH
Posts: 16
Craig Putnam is on a distinguished road
Re: Camera pointing error?

Yesterday I tried something similar to what Kevin outlined, but not quite that exact procedure. I'll do that tomorrow and post the results to this thread.

Thanks to everyone for your replies.
  #6   Spotlight this post!  
Unread 15-01-2006, 22:31
Matt Krass's Avatar
Matt Krass Matt Krass is offline
"Old" and Cranky. Get off my lawn!
AKA: Dark Ages
FRC #0263 (Sachem Aftershock)
Team Role: Mentor
 
Join Date: Oct 2002
Rookie Year: 2002
Location: Long Island, NY
Posts: 1,187
Matt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond reputeMatt Krass has a reputation beyond repute
Send a message via AIM to Matt Krass
Re: Camera pointing error?

We had that problem too, have you played with any of the gain and error settings? We reset them to default and it fixed it, points pretty straight now.
__________________
Matt Krass
If I suggest something to try and fix a problem, and you don't understand what I mean, please PM me!

I'm a FIRST relic of sorts, I remember when we used PBASIC and we got CH Flightsticks in the KoP. In my day we didn't have motorized carts, we pushed our robots uphill, both ways! (Houston 2003!)
  #7   Spotlight this post!  
Unread 16-01-2006, 21:41
Craig Putnam Craig Putnam is offline
Registered User
#0042 (P.A.R.T.S.)
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 1997
Location: Hudson, NH
Posts: 16
Craig Putnam is on a distinguished road
Re: Camera pointing error?

Quote:
Originally Posted by Matt Krass
We had that problem too, have you played with any of the gain and error settings? We reset them to default and it fixed it, points pretty straight now.
Yes, I have played with them and now I have also followed Kevin Watson's instructions as well.

The results are that, when locked onto the target, the pan now pretty consistently reads -3 (degrees) and the tilt reads 0 (degrees). This is with the target about 30 feet straight ahead of and level with the camera. The camera itself still points to the left and high of the target the same as always when locked on.

So, it appears to be an optical alignment error within the camera unit itself. I'm not going to spend any more time on this. It locks on and tracks beautifully - that's good enough.

Thanks to all for this input.
  #8   Spotlight this post!  
Unread 16-01-2006, 23:43
Terry Sherman's Avatar
Terry Sherman Terry Sherman is offline
Mentor -- Software
FRC #0093 (NEW Apple Corps.)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2003
Location: Wisconsin
Posts: 25
Terry Sherman is an unknown quantity at this point
Re: Camera pointing error?

We also so our camera looking a way to the side and up as well and decided to investigate a little bit. One thing we noticed is that the default Pan & Tilt values seem to be reversed. In the code we are using (I haven't checked, maybe Kevin has newer?) we see:
#define PAN_TARGET_PIXEL_DEFAULT 79
#define TILT_TARGET_PIXEL_DEFAULT 119

If I am thinking about this right the screen resolution is 240x160 where the 240 is the x-axis and 160 is the y-axis. The pixel values (if starting at 0) for the center of the screen would be (119,79). I think the x-axis correlates with 'pan' and y-axis to 'tilt'. So we changed the target defaults to:
#define PAN_TARGET_PIXEL_DEFAULT 119
#define TILT_TARGET_PIXEL_DEFAULT 79

And our camera now seems to be centered in on the target once it finds it and not looking off a into the distance a little but.

Note:We also used Sean Witte's 'CMUVisualizer' that he posted at this thread: http://www.chiefdelphi.com/forums/sh...ad.php?t=41240
I don't know if this works but here's a link to his attachment: http://www.chiefdelphi.com/forums/at...achmentid=3780

It now shows us locking in on the center of the screen now as well.

Hope this helps!
-Terry
  #9   Spotlight this post!  
Unread 17-01-2006, 01:21
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
One thing we noticed is that the default Pan & Tilt values seem to be reversed.
Are you sure about that?

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #10   Spotlight this post!  
Unread 17-01-2006, 08:53
Terry Sherman's Avatar
Terry Sherman Terry Sherman is offline
Mentor -- Software
FRC #0093 (NEW Apple Corps.)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2003
Location: Wisconsin
Posts: 25
Terry Sherman is an unknown quantity at this point
Re: Camera pointing error?

Quote:
Originally Posted by Kevin Watson
Are you sure about that?

-Kevin
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
  #11   Spotlight this post!  
Unread 17-01-2006, 17:34
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,904
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Camera pointing error?

Here's a related note from the CMUCAM2 FAQ.

Quote:
Resolution
While it is true that the OV7620 sensor is a higher resolution sensor than the OV6620, because of the fixed memory size of the frame buffer of the CMUcam2, the CMUcam2 only supports a single resolution of 160x239 for the OV7620 sensor. The CMUcam2 supports a low resolution mode of 88x143 and a high resolution mode of 176x255 for the OV6620 sensor. So using the OV6620 in high resolution mode one can actually achieve higher resolution operation that the single resolution mode available for the OV7620 sensor.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
  #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
  #13   Spotlight this post!  
Unread 18-01-2006, 01:26
Terry Sherman's Avatar
Terry Sherman Terry Sherman is offline
Mentor -- Software
FRC #0093 (NEW Apple Corps.)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2003
Location: Wisconsin
Posts: 25
Terry Sherman is an unknown quantity at this point
Re: Camera pointing error?

Kevin,
I did not intend any disrespect with my comment and I’m sorry that you took it that way. I would like to continue this topic with you directly and not add to people’s confusion with this; however, I would like to keep this topic open for the moment as we discuss this topic. I have some information that I will pass along to you.

I’m sorry everyone if I’ve caused confusion, I did not intend to create confusion, rather I wanted to see if anyone else had encountered what we were seeing and if the way we have looked at the situation is the same as others.

-Terry
  #14   Spotlight this post!  
Unread 20-01-2006, 13:01
Terry Sherman's Avatar
Terry Sherman Terry Sherman is offline
Mentor -- Software
FRC #0093 (NEW Apple Corps.)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2003
Location: Wisconsin
Posts: 25
Terry Sherman is an unknown quantity at this point
Re: Camera pointing error?

Kevin,

We investigated again last night and we proved that the resolution was indeed 160x240. Your default values are correct. So we went back to your proper defaults of pan_target 79 and tilt_target 119.

We based trying the rotation of the aspect ratio off the utilities that give us a screen shot of the image. We made an incorrect assumption that the image aspect ratio that the utilities used was the same as the CMUcam2 analysis. As it turns out it, the utilities don't display the decimated data of the CMUcam2 and thus represent the aspect ratio of the imaging module (640x480) rather than the CMUcam2 module (160x240).

Thanks for the support.
-Terry
  #15   Spotlight this post!  
Unread 21-01-2006, 02:52
Joe Hershberger Joe Hershberger is offline
National Instruments
AKA: jhersh
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 1997
Location: Austin, TX
Posts: 148
Joe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to allJoe Hershberger is a name known to all
Re: Camera pointing error?

Quote:
Originally Posted by Terry Sherman
Kevin,

We investigated again last night and we proved that the resolution was indeed 160x240. Your default values are correct. So we went back to your proper defaults of pan_target 79 and tilt_target 119.

We based trying the rotation of the aspect ratio off the utilities that give us a screen shot of the image. We made an incorrect assumption that the image aspect ratio that the utilities used was the same as the CMUcam2 analysis. As it turns out it, the utilities don't display the decimated data of the CMUcam2 and thus represent the aspect ratio of the imaging module (640x480) rather than the CMUcam2 module (160x240).

Thanks for the support.
-Terry
Because the data is decimated in the horizontal axis, the aspext ratio is off by a factor of two. This would not look correct when looking at it. In the LabVIEW application, for instance, each pixel is duplicated in the horizontal axis. This makes the resolution appear to be 320x239, when the raw data is actually 160x239.

I'm not aware of an application that displays it at 640x480.

Cheers!
-Joe
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Use the Google Camera generalbrando Kit & Additional Hardware 2 07-02-2006 16:00
Scripting Setup and the Camera + Serial Port Drivers CJO Programming 22 11-01-2006 17:42
Code error on RC after downloading "bells and whistles" version of Kevins camera code DanDon Programming 6 10-01-2006 18:07
Unresponsive camera neilsonster Programming 9 17-02-2005 08:51
CMUCam2 Camera Code - Are important parts commented out? Mr. Lim Programming 4 14-01-2005 12:11


All times are GMT -5. The time now is 17:51.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi