|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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?
|
|
#2
|
||||
|
||||
|
Re: Possiblity of using a few trig functions
Quote:
-Kevin |
|
#3
|
|||
|
|||
|
Re: Possiblity of using a few trig functions
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.
|
|
#4
|
||||
|
||||
|
Re: Possiblity of using a few trig functions
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.
|
|
#5
|
|||
|
|||
|
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); } |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trig functions in C18 3.10 | dmlawrence | Programming | 9 | 08-02-2008 09:33 |
| Trig. Functions in EasyC | miketwalker | FIRST Tech Challenge | 5 | 07-12-2006 23:27 |
| speed of math.h trig functions? | Jared Russell | Programming | 4 | 07-02-2006 07:13 |
| Trig functions and type conversion | kaszeta | Programming | 6 | 14-01-2006 23:34 |
| Return of the Inverse Trig Functions | Leo M | Programming | 3 | 24-01-2002 08:12 |