View Single Post
  #2   Spotlight this post!  
Unread 26-01-2006, 21:30
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,077
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: How do I get distance between Camera and the target?

Math.

If the target is centered, then:

(goal_height - camera_height) / tan(camera_tilt) = range

The problem is implementing a tan() function on the PIC - check the Whitepapers on Delphi for a few ways to do this (search for CORDIC).

Also, if the target is not centered, then you have to convert the vertical pixel error into an angle and add that to the camera_tilt value. This requires that you know the field of view angle of the camera lens.