Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Possiblity of using a few trig functions (http://www.chiefdelphi.com/forums/showthread.php?t=61936)

baop858 17-01-2008 23:11

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?

Kevin Watson 17-01-2008 23:36

Re: Possiblity of using a few trig functions
 
Quote:

Originally Posted by baop858 (Post 680538)
Do you guys think there will be an problems if I used like 4 trig function on 28.6 ms loop?

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

-Kevin

comphappy 17-01-2008 23:53

Re: Possiblity of using a few trig functions
 
Quote:

Originally Posted by baop858 (Post 680538)
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?

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.

kaszeta 18-01-2008 10:23

Re: Possiblity of using a few trig functions
 
Quote:

Originally Posted by baop858 (Post 680538)
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?

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.

comphappy 18-01-2008 23:55

Re: Possiblity of using a few trig functions
 
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);
}


All times are GMT -5. The time now is 23:20.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi