View Full Version : Camera locks on but it still off
dpick1055
18-02-2007, 00:43
So we finally got our camera completely working, or so we thought. After getting the camera to lock onto the light really well and give us a distance to the light rather accurately we noticed that once the camera was locked on the pan servo was a few degrees off. This meant that when it was locked on from our home zone it appeared as though the camera was off by a foot or two. Is this related to something we did wrong in the code, or is that just how Kevin's bells and whistles code works? Thanks
Kevin Watson
18-02-2007, 01:06
So we finally got our camera completely working, or so we thought. After getting the camera to lock onto the light really well and give us a distance to the light rather accurately we noticed that once the camera was locked on the pan servo was a few degrees off. This meant that when it was locked on from our home zone it appeared as though the camera was off by a foot or two. Is this related to something we did wrong in the code, or is that just how Kevin's bells and whistles code works? ThanksThis has been discussed a few times in the past. Here's one thread (http://www.chiefdelphi.com/forums/showthread.php?threadid=53703).
-Kevin
Right now, when you square up the camera with our chassis, the actual field-of-view (which we found to be around 42* in the pan direction) is about 75% on the right side of our 'bot. We have adjusted the Pan Target pixel so that when tracking the camera unit points straight at the target, but now I am thinking that this isn't really desirable. Who cares where it points, you want the mx values on the center of the image sensor, right? Wouldn't that give you a better chance of not losing the light?
What about using pwm.h to adjust the PWM_CENTER value like so:
Put the light directly in front of your camera/robot but far enough away from it, so that blob size is just a few pixels.
The camera should aim to the left or right of it if the pan tracking pixel is at the center of the image sensor (default).
When the terminal shows that pan error is close to zero pixels (try to get it within one) then record the pwm value being sent to the pan servo.
Add (127 - pwmValueWithZeroPanError) * PWM_GAIN to PWM_CENTER for the pan PWM (or subtract--test which one helps).Now a pan servo of 127 should mean the light is dead ahead (though the camera unit will be pointed away from it).
Is this better than changing the pan target pixel?
Thanks in advance,
Robinson Levin
[Note: I think that there is an underlying assumption in the adjust above that your previous PWM_CENTER value made a pwm output of 127 point the camera straight ahead, right?]
Kevin Watson
18-02-2007, 13:11
...Is this better than changing the pan target pixel?Yes, if the optical offset moves the center tracking pixel that far, I wouldn't decrease your field of view by moving it. If you know what the angular offset is, just add or subtract it from your calculation and you should be good to go.
-Kevin
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.