Calculating Camera Distance

We have the camera set up on our robot, but we are having some very annoying problems. When we hook up our laptop to the rc, it shows the distance being anywhere between -30 to 67000. If anyone has any idea on the equation for calculating distance from the camera to the green cathodes, please post here. Thanks

Kevin Watson has an idea, why not try here
http://kevin.org/frc/2007_frc_range_calc.pdf

we have that already and it is still not working

Are you able to get different tilt angles when you move the robot manually towards the light? We did that as an initial test and had the robot stop when it was ten feet away from the light.

Are you using Kevin’s default camera code? That seemed to work fine for us.

Make sure when you are printf’ing you cast the data as an unsigned int.

Where in the code is the angle defined?

Look in terminal.c at the printf()s that print information when the camera has found a target. If you #include the camera header files, you can use the same information that is printed regarding the tilt angle. Just copy all of the math and assign it to a variable in your code.