There is no way to compute the blob size in advance. It depends on how far the target light is from the edge of the home zone, at what angle the camera is seeing the target light, how well the camera focus is adjusted, the details of lens and sensor geometry on the camera itself, and the distribution of brightness along the white diffuser panel.
The easiest answer is to put a camera where you want and see what it tells you the blob size is. You’ll notice that the size changes based on exactly where the rack is and in which direction it is facing.
Yes, the tan() function in <math.h> takes the degrees argument in radians, so be sure to perform the conversion as Kevin’s software calculates the tilt angle in degrees.
The units for distance will be whatever units you specified the light height and camera height with. In the .pdf document above, the 116 is inches, so be sure you calculate h (the height of your camera off the floor) in inches, and then the result will be in inches.
For one reason or another the distance we were getting using tangent was close (within a couple feet) but not nearly accurate enough. This could be due to significant figures in many different variables (we tried multiple times to make it as accurate as possible).
Does anyone have any say on this?
For now we are using the tilt angle as the indicator at how close we are to the actual light.
Thanks Kevin. This looks great. I’d like to try and make similar adjustments to our camera. However, I’m not sure about the terms that you are using and how they apply to control the pwm outputs. Is there a document that describes the function of pwm outputs (ie. gain, pulse width, etc.) and how servo motors respond to them? I’d like to get a better picture of how the gain of 70 and calculated pulse width of 2.389 combine to control the camera tilt to reach 90 degrees. Thanks again.
Heres a quick introduction to servos. The center and gain values are in units of 100 ns, so a gain of 70 means the pulse width will increase (or decrease) by 7.0 us for each count above (or below) 127. The absolute pulse width at 127 is defined by the center value, which is nominally 15000, or 1.5 ms.