Possiblity of using a few trig functions

Do you guys think there will be an problems if I used like 4 trig function on 28.6 ms loop? If I put the trig functions in the spin function functions would it work better? Would using a look up table for sin cos trig and arctan use up a lot of space?

This won’t be a problem if you aren’t doing anything else time consuming.

-Kevin

I would say that for most things actual trig functions are overkill, a look up table will good enough. As for space, it depends on how many values you need to calculate, and how many places you need them.

Team 95 had done quite a few test bots using field coordinates, where every time through the loop we’d do calls to sin(), cos(), abs(), and atan2(), all while using shaft encoders and the gyro, and it’s never been an issue. I wouldn’t get carried away, however.

I would not expect abs to be take very many processors cycles, could be written as such,
int abs (int num)
{
if(num<0)
{
num=(-1)*num;
}
return(num);
}