View Single Post
  #7   Spotlight this post!  
Unread 05-12-2001, 23:57
John Nielson John Nielson is offline
Registered User
None #0857 (Superior Roboworks)
Team Role: Alumni
 
Join Date: Dec 2001
Rookie Year: 1998
Location: Da U.P. eh
Posts: 3
John Nielson is an unknown quantity at this point
Send a message via AIM to John Nielson
Polar . . . Killough???

For the Question of the Killough the first thing you need to realize is that the
formula is not all that complex. ill just discuess the simple one.

w = abs ( V ) / ( R ) * ( SIN ( theda ) ) + ( Torque * Length ) / R

for my example i can remove the end and multiply by R to just work in speed.

Velocity = abs ( SYS_Velocity ) * ( SIN ( Theda ) )

to work around the sin think of it in terms of only the ratio of Opp / Hyp

verables working with are X and Y on the joy stick

POLAR: THE R VALUE (Hyp)
to get the R value of from the X and Y is easy
'step 1 get the values in 2's complement
Y = ABS ( ( 127 - Y ) ) MIN 0 MAX 254
X = ABS ( ( 127 - X ) ) MIN 0 MAX 254
'step 2 a^2 + b^2 = c^2
SYS_Velocity = SQR ( ( X * X ) + ( Y * Y ) ) MIN 0 MAX 254

Simple eh

Finally
sin ( angle ) = Opp / Hyp
So to bring the value to equal to that returned by a sin in PBASIC i did is took
the equation and replaced it with 254 * Y / SYS_Velocity

Velocity = abs ( SYS_Velocity ) * ( ( 254 * Y ) / SYS_Velocity )

there is my $.02 have fun and see what you can do