I’m Using the streamlined version downloaded for kevin.org/frc
Is there a way to find out the degrees the pan and tilt are in relation to the horizontal and vertical zeros? (i.e camera looking straight forward)
Plus, the zip file downloaded contains everything, the user_routines.c and all that. should i use this as the default code for 2007 and add my autonomous mode and joy controls and all that to that files? or is there a way to add the camera thingies to the 2007 Default code?
Well, I can answer only your first question because I am programing in easyC and I don’t know MPlabs as well.
for calculating the degrees you need to do the following:
same thing for the pan.
The tilt range is the range of degrees the tilt/pan server can turn.
Number of PWM is 256 (0…255).
you need to see the the documentation about your servo, see how much it can turn in degrees.
Oh, and remember when calculating this way: the starting position (the middle of the range) is half of the ratio. For example: if the ratio is 180, then 1 degree equals about 0.7 PWM, and the starting position is in the middle, witch is 90 degrees, witch is about 127 PWM
To tell you the truth I’m not sure either. I can’t find any documentations for this, no place writes how much degrees it has. So please someone answer our common question: how much degrees does it turn?
In Kevin’s code he lists the degrees for each range if using the pan/tilt mechanism for FIRST in tracking.h (for example, the pan servo goes from 0 to 248, and has a total range of 130 degrees). To determine the value your 0’s are at, you will have to manually control the camera until it is in the position you want to be considered “center”.
The servos are driven with standard pwms, so instead of having the camera code create the pan & tilt pwms, have a joystick control the value of the pwm. Comment out servo_track() so the camera has no control of the servos, then do pwm01 = p1_y (with whatever pwms and joystick you want to use inserted there).
So in order to find the range from, for example, the rack, I need to calculate the # of degrees to the target from the servos and then calculate Tan(the angel)and devide the hight of the target from the camera by the Tan(angel)?