|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools |
Rating:
|
Display Modes |
|
#13
|
|||||
|
|||||
|
Re: New C18 3.0+ Compatible FRC Code
I just discovered something else interesting about the gyro code... specifically the way the angle resolution relates to the analog input scaling.
I detected this as I was logging heading data as I was driving around and around our track. On my system I have 4 Analog inputs, that I'm running 4 amples per update at 1600 Hz... This give me a Gyro update rate of 100 updates per second, and an ADC Range of 2048 and In the Gyro code... for an ADXRS150 I have Quote:
Quote:
Max Long is 2147483648 so if I divide this by 204800 I get 10485 ... Which, in theory is the maximum result I can get... But wait, this is millirads so the maximum angle I can measue is... just over 1.6 full rotations... Oops... Either I did my math wrong, or I have to reduce my update rate. In fact, this does reflect what I see in my log data... after getting to 10485 mRad, the angle starts counting down again... So I need to reduce my ADC range/rate, or reduce my measurement accuracy (like changing to tenth of a degree.) No wonder my bot corrected in the wrong direction on evey second lap ![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Does the camera code suits to all versions of MPLAB and C18? | razer | Programming | 3 | 04-01-2007 14:50 |
| Trying to follow C18 interrupt context code... | dcbrown | Programming | 5 | 21-12-2006 09:01 |
| Error w/ FRC code | JamesBrown | Programming | 2 | 08-01-2005 16:17 |
| Programming code Fix FRC | Ferazel2001 | Programming | 6 | 08-02-2004 02:46 |
| FRC default code | hedgehogger | Programming | 2 | 21-01-2004 18:41 |