View Single Post
  #1   Spotlight this post!  
Unread 21-01-2006, 04:39
mogunus mogunus is offline
Registered User
AKA: Luciano DiFalcone
FRC #1350 (Rambots)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2003
Location: RI
Posts: 19
mogunus is an unknown quantity at this point
Servo Values to Degrees... How?

I don't know if this is because it's very early (4AM in RI) or if I'm just dense , I can't for the life of me figure out how to convert from the cmucam servo's values to degrees. I know that in terminal.c keven does what's explained by this comment:

// pan angle = ((current pan PWM) - (pan center PWM)) * degrees/pan PWM step
printf(" Pan Angle (degrees) = %d\r\n", (((int)PAN_SERVO - 124) * 65)/124);

To get the pan angle of the camera. I have no idea how this works, or why.

This is a problem for me, because I just finished implementing a feed-forward-ish style tracking algorithm, based on kevin's original code. I got the idea for it from his post here, and there's another great thread about it here.

I'm definately getting better results from the camera. At least, it looks like it's tracking the light better than before at approx 8 ft. distant in my room, have to test that on the 'bot tomorrow.

But the problem is, my code totally broke going from the servo values to degrees in terminal.c. I know that 128 is the "y-axis." So should I just grab a protracter, and "sv 0 whatever" until it looks like there's a 90 degree difference between the position at 128 and the current position, and divide (current - 128)/90 degrees travelled? And would that give me proper degrees/single servo pwm value?

Sorry if that was all really incoherant. Any help would be greatly appreciated.