|
don't be silly...
Posted by Joe Johnson at 1/19/2001 10:11 PM EST
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.
In Reply to: Yah, I tried that too :=)
Posted by Matt Berube on 1/19/2001 7:54 AM EST:
Yes you can do trig in PBASIC.
The problem is a little messy if you need to do an
inverse trig function, but this can be arranged too.
The most confusing part when you first try to use them
is that the measurement of angle is in a very funky
unit. Basically the circle is divided up from 0 to
255, so the angles are measured in increments of 1.4
degrees -- not the easiest unit of measure but it works
in a pinch.
By the way, when we need to convert the X-Y coords of
the joystick into "polar" coords of Radius-Theta, we
found that it was close enough for us to just use the
following function as the "radius" rather than go
through all the bother of computing the "true" radius
Radius = abs(Y1 - $80) MIN abs(X1 - $80)
This function returns the "square" that the joystick is
on rather than the "cirle" that is is on, but again it
is close enough for robot control AND it is a LOT
simpler to code than all the nonsense needed to get the
"true" answer.
There are similar simplifications that can get you the
angle of the joystick. I leave those as an exercise
for the reader.
Joe J.
__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.
|