|
Re: get distance from cmucam
Haven't written the code yet, but just so you know, you can't get the distance to target *directly* from the camera (without some elegant code that I don't know about). However, it is still rather easy.
Using Kevin Watson's Default camera code, there should be a variable called something like tilt_value. Using this value, after converting the PWM value into a useable angle, you can employ a bit of triganometry to derive the distance to target.
(Vert_goal_hight/(tan(angle_to_goal)))= distnce to goal
I would use a lookup table, it'll be much faster than constantly calculating the distance.
__________________
Reading makes a full man, conference a ready man, and writing an exact man. -Sir Francis Bacon
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein
|