View Single Post
  #3   Spotlight this post!  
Unread 30-01-2006, 22:54
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Moving robot while tracking with camera questions...

You might want to use trig fuctions to calculate the horizontal distance of target.

first include <math.h> where ever you want to do the trig calculations.

then look in terminal.c for the pan angle and tilt angle ratios
65/124 degrees for every pan pwm increment and 25/50 degrees for every tilt pwm increment

going to have to make it output 0 degrees when looking completely horizontal
adjust the -124 value

then just set up the equation
target_distance = height/tan(tilt_angle)

height = the vertical distance between the camera on the robot and the green light.

you can just make pwm03 = p1_y for example

you need to uncomment the default() function and remember to comment out the pwm's being used by the camera

Last edited by 6600gt : 30-01-2006 at 22:58.