|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
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 ![]() |
|
#2
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
Code:
void Read_Yaw(void) {
phi=Get_Gyro_Angle();
phi=phi%6283L; // Avoid unneccesary wraparound
}
|
|
#3
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
.-Kevin |
|
#4
|
||||
|
||||
|
Sorry if this has been addressed before I don’t have time to go through all 288 posts but we are having an issue when we compile. Here is what our output looks like, if anyone can help it would be greatly appreciated. Thank you
Code:
Clean: Deleting intermediary and output files. Clean: Deleted file "C:\FRC2008\2008 Code\ifi_frc_simple_30\ifi_frc.mcs". Clean: Done. Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 "autonomous.c" -fo="autonomous.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- C:\FRC2008\2008 Code\ifi_frc_simple_30\ifi_frc.h:31:Error [1027] unable to locate 'p18cxxx.h' C:\FRC2008\2008 Code\ifi_frc_simple_30\serial_ports.h:48:Error [1027] unable to locate 'stdio.h' Halting build on first failure as requested. BUILD FAILED: Thu Jan 24 15:12:09 2008 |
|
#5
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
You need to go to the project menu then build options then project
On the directory tab select Header Search Path (i dont have mplab infront of me right now but it is the header one), create a new one that points to the mcc18\include folder where ever that may be, it might be in C:\Program Files\ or just under C:\ Seeing as that variable is off you may also need to set the Library Search Path to mcc18\lib folder |
|
#6
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin |
|
#7
|
||||
|
||||
|
Quote:
Code:
Clean: Deleting intermediary and output files. Clean: Done. Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "autonomous.c" -fo="autonomous.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "disabled.c" -fo="disabled.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "ifi_code.c" -fo="ifi_code.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "ifi_frc.c" -fo="ifi_frc.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "interrupts.c" -fo="interrupts.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "pwm.c" -fo="pwm.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "serial_ports.c" -fo="serial_ports.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "teleop.c" -fo="teleop.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- C:\FRC2008\2008 Code\ifi_frc_simple_30\teleop.c:105:Warning [2066] type qualifier mismatch in assignment Executing: "C:\mcc18\bin\mcc18.exe" -p=18F8722 /i"C:\mcc18\h" "timers.c" -fo="timers.o" -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa- Executing: "C:\mcc18\bin\mplink.exe" /l"C:\Program Files\microchip\mcc18\lib" "C:\FRC2008\2008 Code\ifi_frc_simple_30\18f8722.lkr" "C:\FRC2008\2008 Code\ifi_frc_simple_30\autonomous.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\disabled.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\ifi_code.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\ifi_frc.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\interrupts.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\pwm.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\serial_ports.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\teleop.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\timers.o" "C:\FRC2008\2008 Code\ifi_frc_simple_30\ifi_frc_8722.lib" /m"ifi_frc.map" /w /o"ifi_frc.cof" MPLINK 4.1, Linker Copyright (c) 2006 Microchip Technology Inc. Error - could not find file 'clib.lib'. Errors : 1 Link step failed. BUILD FAILED: Thu Jan 24 19:11:44 2008 |
|
#8
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
The first warning can be eliminated by changing the memory model to large: Project > Build Options > MPLAB C18 tab > Catagories: Memory Model > select large model for code and data.
The clib.lib error is due to MPLAB not knowing where your compiler libraries are installed: Project > Build Options > Directories tab > Library Search Path -Kevin |
|
#9
|
||||
|
||||
|
cool, it all works now, thank you very much
![]() |
|
#10
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Just FYI, I believe that I have a single version of the code that will work with all robot controllers from 2004 on and can be built with C18 2.4 or 3.1. After seeing if I can improve the gyro integration code (per Philbot's posting above), doing some additional testing, and writing a bit more documentation, I should be able to release the code in the next few days.
-Kevin |
|
#11
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
You truly are an example that all FIRSTers can look to, including myself. Thank you for your incredible efforts!! |
|
#12
|
|||
|
|||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
I'd like to add my thanks for the great work on the new framework. We use the 8520 for small groups prototyping code. I know you are working on a set of code that will work for all controllers, but I was wondering if the message you have in adc.c: * This version will only work with PIC18F8722 based robot * controllers. You should use version 0.3 of this software * with a PIC18F8520 based robot controller. is still valid. And if so, how would I go about getting version 0.3 of the adc.[ch]? Thanks! |
|
#13
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
Quote:
-Kevin (If you can't wait and promise to report any bugs you find, here's a snapshot of the latest build without the gyro mods) |
|
#14
|
||||
|
||||
|
Re: New C18 3.0+ Compatible FRC Code
I've posted a snapshot of what I hope is the last build for a while. The changes are numerous and include improved gyro code. The documentation still needs some work, but the code should be complete. If you're willing to test it and provide feedback and/or bug report(s), you'll find it here: http://kevin.org/frc/ifi_frc_sensor.zip.
-Kevin |
|
#15
|
|||
|
|||
|
Get_Gyro_Rate() returns jumpy values
when I call Get_Gyro_Rate() it tends to give occasional outliers and data that doesn't make sense. When I turn the gyro constantly one direction, jumps back and forth between positive numbers. Get_Gyro_Angle() works fine and is accurate. I am testing with last year's kit gyro.
Last edited by sparrowkc : 29-01-2008 at 16:32. Reason: typo |
![]() |
| 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 |