CMU2Cam Degrees & more

Hi,
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?

Thanks,
Carmel

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:
1 degree=Tilt_range/Number_of_PWM

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).

Thanks alot for that,
How can I find out the Tilt/Pan Ratio?

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

It’s the servos we recieved from FIRST, we didn’t get any docs with it

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?

It has a rotation of approximately 90 degrees

http://www.servocity.com/html/hs-322hd_standard_deluxe.html

So this means that each PWM is 256/90=2.8444… degrees.
And each degree is 90/256=0.3515625 degrees.

:::EDIT:::
It’s not 90 degrees for sure, you can buy one with 180 degrees and one with 360 degrees.
So can anybody tell how much degrees it is in the FIRST kit of parts?

Or, you can always drive the servo to 0, mark its position, drive it 255, mark its position, and then bust out a protractor.

We did a lot of testing to find the camera field of view and servo ranges in 2005. If I find them later, I will post them, although they may not be exactly the same.

http://www.acroname.com/robotics/info/ideas/mod322hd/mod322hd.html

look at ‘step 4’, first two lines

more than 180:
http://www.phidgetsusa.com/forums/archive/index.php?t-553.html

How do you drive the servos? This would be very useful for us to debug something.

Jason

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).

If you’re using the “bells & whistles” camera code, you can step the servos to any value using the interactive PWM sub-menu found in the main tracking menu.

-Kevin

Great, thanks!

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)?

Yes, that should work.

ps angle is spelled le

When you type as fast as I do, you’d probablly get the 15 minute delay for writing a long password too fast 5 times and get a wrong password error. :stuck_out_tongue:
Thanks.