
11-02-2012, 00:48
|
|
Turing-complete
 FRC #1255 (Blarglefish)
Team Role: Programmer
|
|
Join Date: Jan 2011
Rookie Year: 2011
Location: Baytown, TX
Posts: 60
|
|
|
Re: Distance Algorithm
Quote:
Originally Posted by jesusrambo
So far it's generally accurate within a few inches. Tweak the FOV number a little though, if you need. And keep in mind that FOV will change depending on if you're using the Axis 206 or the Axis M1011 camera.
Since we're using the height of the rectangle, you will notice increased error if you're driving up really close to it, since your angle will start getting funky, but the alternative is using the width, and that'll get thrown off by moving left to right at all. What we figure is since we're shooting we're not too likely to be up really close to the target anyways, so it's better to make that tradeoff.
Also, I accidentally have width*x_res writte in that image, that should be y_res if you're using the height of the rectangle.
|
You should be able to account for being under the targets by checking when width:height > 1.33 and calculating an angle from that ratio.
|