Have any teams used vector mathematics in their robot code? Did you have trouble implementing operations such as vector addition, multiplication, or dot products? Were the trigonometric functions accurate enough?
The problem with “vector math” is not really a problem using PBASIC – the only problem is that you have to do everything yourself – no functions are easily there for you to call to do the various stuff you would like to do with Vectors.
The biggest problem is actually just the unsigned 16 bit math makes things more tricky than usual.
On several of our robots, we kept track of the center of gravity of the arm. This allowed us to put in a “virtual counter balance” term so that our feedback loop did not have to have such a high gain.
Apart from the unsigned 16 bit math problem, the next thing was keeping straight the units of the arquments that the trig functions take.
One more thing is the bother of not enough memory or variable space.
Finally, it really stinks that there is no ASIN or ATAN. It would have been nice to use on many occassions. This is something we have gotten around (lookup is a wonderful function) but it is not as easy.
Good Luck,
Joe J.
Interesting. Those were the concerns that our lead programmer had problems with.
We were going to test a new robot platform (Killough) and we needed some good vector mathematics. He said that he’d have to rework all the problems to use binary radians as well as positive integers. He also didn’t like the possibility of dropped bits (read: accuracy) of PBASIC division.
Hm, hopefully FIRST will introduce a new control system. grin Perhaps something along the lines of a 33 MHz Dragonball VZ processor? Oh, I only hope.
Inverse sine and inverse cosine functions would be great additions to the PBasic language. I was trying to create polar coordinates for the joystick, but without these, I am at a loss as to how to do it.
One of our programmers, Matt Totino, is disassembling his old computer joystick to see if he can create a joystick that gives out polar coordinates. Instead of returning x and y values, it would return degree (from a re-oriented potentiometer) and radius (taper potentiometer) values.
Well in designing a very crude ‘4 wheel steering’ system over the summer I ran into a very similar problem. The solution I came up with is rather crude as well but it appears to work. I normalized the X and Y values to 1000 and then looked at the difference between the two to get the angle that the joystick is at and also the angle the wheels should be pointing to. I can include a bit of the code on how I did it. Again it probably (for sure) isn’t the best way to do it but it works for now.
Any more questions feel free to e-mail me.
B.T.W. the file is a section of the code I am just getting into breaking into slots I have the rest if you need it
sidestep.zip (4.07 KB)
sidestep.zip (4.07 KB)
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
Where can I find details on formulas for the Killough platform? The only web site that I’ve found that has any data is the Palm Pilot Robot Kit, which uses a Killough-style design.
here are the formulas stright form my code . . . you each representating each leg
’ The Three Full Formulas for the motion of the killough platform
’ w = abs ( V ) / ( 2 * R ) * ( SIN ( theda ) - SQR ( 3 ) COS ( theda ) ) + ( T * L ) / R
’ w = abs ( V ) / ( R ) * ( SIN ( theda ) ) + ( torque * lingth ) / R
’ w = abs ( V ) / ( 2 * R ) * ( SIN ( theda ) + SQR ( 3 ) COS ( theda ) ) + ( T * L ) / R
The real key to the Killough is the spelling of “theda.”
Adam
This is the matrix form of the equations i said earler. it’s easy to read if you write them out by hand.
Vx = | V | cos ( theda )
Vy = | V | sin ( theda )
( w1 , w2 , w3 )^T = A ( Vx , Vy , Torq )^T
A = ( 1 / R )
-(3^.5)/2 .5 L1 ]
0 -1 L2 ]
(3^.5)/2 .5 L3 ] ]
there is your matrix form of the of the three equations i set out befor . . . this is how i and a math prof aproced the problem of the equations of motion for the platform and this is the end of the derivation. my answer was the same as killough’s
Yes adem i am still going to spell theda wrong. that is how it is spelled out in the code and abstract. you know that.
– john