View Single Post
  #14   Spotlight this post!  
Unread 31-10-2003, 15:43
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,644
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Off topic... ...but important...

From Betts:
Quote:
Dr. J,

Although I am sure one exists, I usually roll my own using a Taylor Series expansion as a basis. It allows me to exactly control the precision and error I can tolerate for my application. I also know exactly how many machine operations I am executing.
Assuming Autonomous Mode stays and/or gets harder in 2003, The ability to do trig fast and efficiently is going to be an important topic.

I don't see any reason why we should all roll our own.

I think we should start a new thread on just this topic. I have done a bit of digging and found a possible candidate. I will keep you posted

As an example of the kind of things we should think about is that we can save code space by only writing a cosine function and using trig identities (e.g. sin(theta) = cos(pi/2-theta) to calculate the other functions.

Also, the series will converge faster if you expand about a point closer to the point of interest. It may be faster for a given amount of desired error to use a series of expansions based on the value of theta rather than a single expansion about zero.

For example:

use an expansion about 0 for values -pi/8 <= theta < pi/8
and
use an expansion around pi/4 for values pi/8 <= theta < 3pi/8
and
use trig identities to get all other values of theta to map to this range

Again, while this is a good exercise for the student, I see no reason for us all to roll our own code for these very useful functions.

There is going to be a lot for us all to learn...

Joe J.